CN113938408B - Data traffic testing method and device, server and storage medium - Google Patents

Data traffic testing method and device, server and storage medium Download PDF

Info

Publication number
CN113938408B
CN113938408B CN202111200623.XA CN202111200623A CN113938408B CN 113938408 B CN113938408 B CN 113938408B CN 202111200623 A CN202111200623 A CN 202111200623A CN 113938408 B CN113938408 B CN 113938408B
Authority
CN
China
Prior art keywords
response message
service unit
data
actual response
comparison
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111200623.XA
Other languages
Chinese (zh)
Other versions
CN113938408A (en
Inventor
唐俊杰
余涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111200623.XA priority Critical patent/CN113938408B/en
Publication of CN113938408A publication Critical patent/CN113938408A/en
Application granted granted Critical
Publication of CN113938408B publication Critical patent/CN113938408B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0876Network utilisation, e.g. volume of load or congestion level

Landscapes

  • Engineering & Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention relates to the field of big data and discloses a data flow testing method, a device, a server and a storage medium, wherein the method comprises the following steps: acquiring one or more data requests sent to a server by a client and an actual response message sent to the client by the server; determining each data request and an actual response message corresponding to each data request as a service unit; simulating and responding to the data requests in each service unit, and performing playback test on the data flow corresponding to the data requests in each service unit to obtain corresponding simulated response messages; and comparing the content of the simulated response message with that of the actual response message, and determining that the playback test of the data flow is successful when the comparison result is consistent, so that the regression test of the data flow is efficiently and rapidly performed, and the efficiency and the accuracy of the playback test of the data flow are improved. The present invention relates to blockchain techniques, such as writing data into blockchains for use in data forensics and other scenarios.

Description

Data traffic testing method and device, server and storage medium
Technical Field
The present invention relates to the field of big data, and in particular, to a method and apparatus for testing data traffic, a server, and a storage medium.
Background
For the preservation and playback of traffic, most of the schemes adopted in the industry are realized by tcpdump tools on Liunex at present; or the request and the response result of each request are saved by analyzing Apache or Nginx request logs or other open source tools (such as httpry, goreplay), and the response result obtained by each request is released and completely compared with the last reserved response result so as to verify whether the request meets expectations.
However, the request and the response result saved by the scheme adopted at present are binary, and cannot be well visually displayed, so that the comparison efficiency of the response result is low, and the efficiency and the accuracy of the regression test of the data flow are low. Therefore, how to test data traffic more effectively becomes an important point of research.
Disclosure of Invention
The embodiment of the invention provides a data flow testing method, a device, a server and a medium, which realize the efficient and rapid regression testing of data flow and improve the efficiency and accuracy of the playback testing of the data flow.
In a first aspect, an embodiment of the present invention provides a data traffic testing method, applied to a server, where the method includes:
acquiring one or more data requests sent to a server by a client in a specified time range and actual response messages sent to the client by the server for each data request;
determining the obtained actual response messages corresponding to the data requests as service units;
simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit;
and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
Further, after determining the obtained data requests and the actual response messages corresponding to the data requests as service units, the method further includes:
Acquiring the sending time of each data request, and sequencing each service unit according to the sequence of the sending time of each data request;
the simulating responding to the data request in each service unit comprises the following steps:
and sequentially simulating and responding to the data requests in the service units according to the sequence of the service units.
Further, before comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit, the method further includes:
acquiring one or more pieces of address information pre-led in and menu information to which the address information belongs from a preset rule list;
and determining comparison rules of the address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rules are used for indicating and comparing one or more designated fields in each response message.
Further, the content comparing the analog response message in each service unit with the actual response message in each service unit includes:
Acquiring each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit;
and performing content comparison on each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit.
Further, when the comparison results are consistent, determining that the playback test of the data flow corresponding to the data request in each service unit is successful includes:
when each specified field corresponding to the comparison rule in the simulated response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, determining that the playback test of the flow of the data request in each service unit is successful;
and when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, determining that the playback test of the flow of the data request in each service unit is unsuccessful.
Further, the comparing the analog response message in each service unit with the actual response message in each service unit includes:
analyzing the simulation response messages in each service unit to obtain first keywords corresponding to the simulation response messages in each service unit;
analyzing the actual response messages in each service unit to obtain second keywords corresponding to the actual response messages in each service unit;
and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword.
Further, the content comparing the analog response message in each service unit with the actual response message in each service unit according to the first keyword and the second keyword includes:
acquiring a first field corresponding to the first keyword in the analog response message in each service unit and a second field corresponding to the second keyword in the actual response message in each service unit;
Sorting the first keywords and the second keywords according to the sequence of each letter in the alphabet;
and comparing the content of the first field with the content of the second field according to the ordering of the first keyword and the second keyword.
In a second aspect, an embodiment of the present invention provides a data traffic testing device, including:
the system comprises an acquisition unit, a server and a storage unit, wherein the acquisition unit is used for acquiring one or more data requests sent to the server by a client in a specified time range and actual response messages sent to the client by the server for each data request;
the determining unit is used for determining the obtained data requests and the actual response messages corresponding to the data requests as service units;
the test unit is used for simulating and responding to the data requests in each service unit, and performing playback test on the data flow corresponding to the data requests in each service unit to obtain simulated response messages corresponding to the data requests in each service unit;
and the comparison unit is used for comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
In a third aspect, an embodiment of the present invention provides a server, including a processor and a memory, where the memory is configured to store a computer program, the computer program including a program, and the processor is configured to invoke the computer program to perform the method of the first aspect.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program for execution by a processor to implement the method of the first aspect.
The embodiment of the invention can acquire one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request; determining the obtained actual response messages corresponding to the data requests as service units; simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent. By the method, the regression test of the data flow is efficiently and rapidly performed, and the efficiency and accuracy of the playback test of the data flow are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a data flow testing method according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of a data flow testing device according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a server according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The data flow testing method provided by the embodiment of the invention can be applied to a data flow testing device, in some embodiments, the data flow testing device is arranged in a server, and in some embodiments, the server comprises one or more of a smart phone, a tablet computer, a laptop computer and the like.
The embodiment of the invention can acquire one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request; determining the obtained actual response messages corresponding to the data requests as service units; simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
According to the embodiment of the invention, the acquired data request and the corresponding actual response message sent to the server by the client are determined to be the service unit, so that regression test can be performed on data traffic more efficiently and rapidly, and data management can be performed on the data request and the actual response message more effectively; by comparing the simulated response message and the actual response message of each service unit, the test efficiency and accuracy of the data flow are improved.
The embodiment of the application can acquire and process related data (such as data request, actual response message and the like) based on artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
The data flow testing method provided by the embodiment of the invention is schematically described below with reference to fig. 1.
Referring to fig. 1, fig. 1 is a schematic flow chart of a data traffic testing method according to an embodiment of the present invention, and as shown in fig. 1, the method may be performed by a data traffic testing device, where the data traffic testing device is disposed in a server. Specifically, the method of the embodiment of the invention comprises the following steps.
S101: and acquiring one or more data requests sent to a server by the client in a specified time range and actual response messages sent to the client by the server for each data request.
In the embodiment of the invention, the data flow testing device can acquire one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request. In some embodiments, the specified time range may be any time range that is preset, and is not specifically limited herein.
In one embodiment, the data flow testing device may store each obtained data request and each actual response message after obtaining one or more data requests sent by the client to the server in a specified time range and each actual response message sent by the server to the client for each data request.
In one embodiment, when the data flow testing device obtains one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request, the data flow testing device can intercept the one or more data requests sent to the server by the client in the specified time range and the actual response messages sent to the client by the server for each data request through a filter in a gateway.
In some embodiments, the data request includes, but is not limited to, a request UR, a request header, a request body, etc., and the actual response message includes, but is not limited to, a response header, a response body, etc.
In some embodiments, the data request and the actual response message sent by the client to the server may be json formatted text information or xml formatted text information. The text information in the format is utilized to conveniently display the detailed information of the data request and the actual response message.
S102: and determining the obtained data requests and the actual response messages corresponding to the data requests as service units.
In the embodiment of the invention, the data flow testing device can determine the obtained data requests and the actual response messages corresponding to the data requests as the service units. The service unit is a generic term of a data request and an actual response message, and the service unit includes a correspondence between the data request and the actual response message, for example, when a scene of inquiring a phone fee balance of a target mobile phone account is queried, the data flow testing device may acquire a data inquiry request of the phone fee balance of the target mobile phone account sent to the server by the client, after receiving the data inquiry request, the server may respond to the data inquiry request to acquire an actual response message of the phone fee balance of the target mobile phone account, and send the actual response message of the phone fee balance of the target mobile phone account to the client, and the data flow testing device may use the data inquiry request and the actual response message of the phone fee balance of the target mobile phone account as a service unit, so that when a playback test of data flow is performed with respect to the data inquiry request of the phone fee balance of the target mobile phone account, the data inquiry request and the actual response message in the service unit may be compared as a comparison object of the data inquiry request and the corresponding analog response message.
In one embodiment, the data traffic testing device may obtain the sending time of each data request after determining the obtained data requests and the actual response messages corresponding to each data request as service units, and sequence each service unit according to the sequence of the sending time of each data request.
S103: and simulating and responding to the data requests in each service unit, and performing playback test on the data flow corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit.
In the embodiment of the invention, the data flow testing device can simulate and respond to the data requests in each service unit, and perform playback testing on the data flow corresponding to the data requests in each service unit to obtain the simulated response message corresponding to the data requests in each service unit.
In one embodiment, when the data flow testing device responds to the data requests in each service unit in a simulation manner, the data flow testing device can respond to the data requests in each service unit in a sequential simulation manner according to the sequence of each service unit, and perform playback testing on the data flow corresponding to the data requests in each service unit to obtain a simulation response message corresponding to the data requests in each service unit.
In one embodiment, the data flow testing device may perform playback testing on the data flow of the data request in each service unit by using a designated tool when performing playback testing on the data flow of the data request in each service unit. In certain embodiments, the specified tools include, but are not limited to, the OkHttp3 tool.
S104: and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
In the embodiment of the invention, the data flow testing device can compare the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and when the comparison results are consistent, the data flow testing device determines that the playback test of the data flow corresponding to the data request in each service unit is successful.
In one embodiment, when comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit, the data traffic testing device may compare the text of the analog response message in each service unit with the text of the actual response message in each service unit. In other embodiments, when content comparison is performed, one or more of numbers, message lengths, letters, etc. in each message may also be compared.
In one embodiment, the data flow testing device may acquire one or more address information and menu information to which each address information belongs, which are pre-led, from a preset rule list before comparing the content of the analog response message in each service unit with that of the actual response message in each service unit; and determining comparison rules of the address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rules are used for indicating and comparing one or more designated fields in each response message. For example, the comparison rule is used to indicate that one or more specified fields in each response packet are (userId, mobile).
In one embodiment, when comparing the analog response message in each service unit with the actual response message in each service unit, the data traffic testing device may acquire each specified field corresponding to the comparison rule in the analog response message in each service unit, and each specified field corresponding to the comparison rule in the actual response message in each service unit; and performing content comparison on each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit.
In one embodiment, when the comparison result is consistent, the data flow testing device determines that the playback test of the data flow corresponding to the data request in each service unit is successful, and when each specified field corresponding to the comparison rule in the analog response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, the data flow testing device may determine that the playback test of the data request in each service unit is successful; and when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, determining that the playback test of the flow of the data request in each service unit is unsuccessful.
For example, content comparison can be performed between the userId and mobile specified fields corresponding to the comparison rule in the analog response message in each service unit and the userId and mobile specified fields in the actual response message in each service unit according to the specified fields (userId) in the comparison rule, if the comparison result is consistent, it can be determined that the playback test of the flow of the data request in each service unit is successful, and if the comparison result is inconsistent, it can be determined that the playback test of the flow of the data request in each service unit is unsuccessful.
In one embodiment, when comparing the analog response message in each service unit with the actual response message in each service unit, the data flow testing device may parse the analog response message in each service unit to obtain a first keyword corresponding to the analog response message in each service unit; analyzing the actual response messages in each service unit to obtain second keywords corresponding to the actual response messages in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword.
In one embodiment, the data traffic testing device may obtain a first field corresponding to the first keyword in the analog response message in each service unit and a second field corresponding to the second keyword in the actual response message in each service unit when comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword; sorting the first keywords and the second keywords according to the sequence of each letter in the alphabet; and comparing the content of the first field with the content of the second field according to the ordering of the first keyword and the second keyword. In some embodiments, the first keyword and the second keyword may include, but are not limited to, one or more of text, letters, numbers, etc., and are not specifically limited herein.
In one embodiment, the data flow testing device may compare the text content in the first field with the text content in the second field when comparing the content of the first field with the content of the second field. In other embodiments, the data traffic testing device may also compare the length of the first field with the length of the second field; the embodiment of the invention does not specifically limit the content comparison of the first field and the second field.
In the embodiment of the invention, the data flow testing device can acquire one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request; determining the obtained actual response messages corresponding to the data requests as service units; simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent. According to the embodiment of the invention, the acquired data request and the corresponding actual response message sent to the server by the client are determined to be the service unit, so that regression test can be performed on data traffic more efficiently and rapidly, and data management can be performed on the data request and the actual response message more effectively; by comparing one or more designated fields in the response message when comparing the analog response message and the actual response message of each service unit, the comparison efficiency is improved, and the efficiency, flexibility and accuracy of the playback test of the data traffic are improved.
The embodiment of the invention also provides a data flow testing device which is used for executing the unit of the method. Specifically, referring to fig. 2, fig. 2 is a schematic block diagram of a data flow testing apparatus according to an embodiment of the present invention. The data flow rate testing device of the present embodiment includes: an acquisition unit 201, a determination unit 202, a test unit 203, and a comparison unit 204.
An obtaining unit 201, configured to obtain one or more data requests sent by a client to a server within a specified time range, and an actual response packet sent by the server to the client for each data request;
a determining unit 202, configured to determine each acquired data request and an actual response packet corresponding to each data request as a service unit;
the test unit 203 is configured to perform a playback test on a data flow corresponding to the data request in each service unit in a simulated response manner to the data request in each service unit, so as to obtain a simulated response message corresponding to the data request in each service unit;
and the comparison unit 204 is configured to compare the content of the analog response message in each service unit with the content of the actual response message in each service unit, and determine that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
Further, after the determining unit 202 determines the obtained data requests and the actual response messages corresponding to the data requests as service units, the determining unit is further configured to:
acquiring the sending time of each data request, and sequencing each service unit according to the sequence of the sending time of each data request;
the test unit 203 is specifically configured to, when responding to the data request in each service unit in a simulation manner:
and sequentially simulating and responding to the data requests in the service units according to the sequence of the service units.
Further, before the comparing unit 204 compares the content of the analog response message in each service unit with the content of the actual response message in each service unit, the comparing unit is further configured to:
acquiring one or more pieces of address information pre-led in and menu information to which the address information belongs from a preset rule list;
and determining comparison rules of the address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rules are used for indicating and comparing one or more designated fields in each response message.
Further, when the comparing unit 204 compares the content of the analog response message in each service unit with the content of the actual response message in each service unit, the comparing unit is specifically configured to:
acquiring each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit;
and performing content comparison on each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit.
Further, when the comparison result is consistent, the comparison unit 204 determines that the playback test of the data flow corresponding to the data request in each service unit is successful, and is specifically configured to:
when each specified field corresponding to the comparison rule in the simulated response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, determining that the playback test of the flow of the data request in each service unit is successful;
And when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, determining that the playback test of the flow of the data request in each service unit is unsuccessful.
Further, when the comparing unit 204 compares the analog response message in each service unit with the actual response message in each service unit, the comparing unit is specifically configured to:
analyzing the simulation response messages in each service unit to obtain first keywords corresponding to the simulation response messages in each service unit;
analyzing the actual response messages in each service unit to obtain second keywords corresponding to the actual response messages in each service unit;
and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword.
Further, when the comparing unit 204 compares the content of the analog response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword, the comparing unit is specifically configured to:
acquiring a first field corresponding to the first keyword in the analog response message in each service unit and a second field corresponding to the second keyword in the actual response message in each service unit;
sorting the first keywords and the second keywords according to the sequence of each letter in the alphabet;
and comparing the content of the first field with the content of the second field according to the ordering of the first keyword and the second keyword.
In the embodiment of the invention, the data flow testing device can acquire one or more data requests sent to the server by the client in a specified time range and actual response messages sent to the client by the server for each data request; determining the obtained actual response messages corresponding to the data requests as service units; simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent. According to the embodiment of the invention, the acquired data request and the corresponding actual response message sent to the server by the client are determined to be the service unit, so that regression test can be performed on data traffic more efficiently and rapidly, and data management can be performed on the data request and the actual response message more effectively; by comparing one or more designated fields in the response message when comparing the analog response message and the actual response message of each service unit, the comparison efficiency is improved, and the efficiency, flexibility and accuracy of the playback test of the data traffic are improved.
Referring to fig. 3, fig. 3 is a schematic block diagram of a server according to an embodiment of the present invention, and in some embodiments, the server according to the present embodiment shown in fig. 3 may include: one or more processors 301; one or more input devices 302, one or more output devices 303, and a memory 304. The processor 301, the input device 302, the output device 303, and the memory 304 are connected via a bus 305. The memory 304 is used for storing a computer program comprising a program, and the processor 301 is used for executing the program stored in the memory 304. Wherein the processor 301 is configured to invoke the program execution:
acquiring one or more data requests sent to a server by a client in a specified time range and actual response messages sent to the client by the server for each data request;
determining the obtained actual response messages corresponding to the data requests as service units;
simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit;
And comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent.
Further, after determining the obtained data requests and the actual response messages corresponding to the data requests as service units, the processor 301 is further configured to:
acquiring the sending time of each data request, and sequencing each service unit according to the sequence of the sending time of each data request;
the processor 301 is specifically configured to, when responding to the data request in each service unit:
and sequentially simulating and responding to the data requests in the service units according to the sequence of the service units.
Further, before comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit, the processor 301 is further configured to:
acquiring one or more pieces of address information pre-led in and menu information to which the address information belongs from a preset rule list;
And determining comparison rules of the address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rules are used for indicating and comparing one or more designated fields in each response message.
Further, when the processor 301 compares the content of the analog response message in each service unit with the content of the actual response message in each service unit, the processor is specifically configured to:
acquiring each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit;
and performing content comparison on each specified field corresponding to the comparison rule in the simulated response message in each service unit and each specified field corresponding to the comparison rule in the actual response message in each service unit.
Further, when the comparison results are consistent, the processor 301 determines that the playback test of the data traffic corresponding to the data request in each service unit is successful, and is specifically configured to:
When each specified field corresponding to the comparison rule in the simulated response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, determining that the playback test of the flow of the data request in each service unit is successful;
and when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, determining that the playback test of the flow of the data request in each service unit is unsuccessful.
Further, when the processor 301 compares the analog response message in each service unit with the actual response message in each service unit, the processor is specifically configured to:
analyzing the simulation response messages in each service unit to obtain first keywords corresponding to the simulation response messages in each service unit;
Analyzing the actual response messages in each service unit to obtain second keywords corresponding to the actual response messages in each service unit;
and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword.
Further, when the processor 301 compares the content of the analog response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword, the processor is specifically configured to:
acquiring a first field corresponding to the first keyword in the analog response message in each service unit and a second field corresponding to the second keyword in the actual response message in each service unit;
sorting the first keywords and the second keywords according to the sequence of each letter in the alphabet;
and comparing the content of the first field with the content of the second field according to the ordering of the first keyword and the second keyword.
In the embodiment of the invention, a server can acquire one or more data requests sent to the server by a client in a specified time range and actual response messages sent to the client by the server for each data request; determining the obtained actual response messages corresponding to the data requests as service units; simulating and responding to the data requests in each service unit, and performing playback test on data traffic corresponding to the data requests in each service unit to obtain simulation response messages corresponding to the data requests in each service unit; and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent. According to the embodiment of the invention, the acquired data request and the corresponding actual response message sent to the server by the client are determined to be the service unit, so that regression test can be performed on data traffic more efficiently and rapidly, and data management can be performed on the data request and the actual response message more effectively; by comparing one or more designated fields in the response message when comparing the analog response message and the actual response message of each service unit, the comparison efficiency is improved, and the efficiency, flexibility and accuracy of the playback test of the data traffic are improved.
It should be appreciated that in embodiments of the present invention, the processor 301 may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The input device 302 may include a touch pad, a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.
The memory 304 may include read only memory and random access memory and provides instructions and data to the processor 301. A portion of memory 304 may also include non-volatile random access memory. For example, the memory 304 may also store information of device type.
In a specific implementation, the processor 301, the input device 302, and the output device 303 described in the embodiments of the present invention may execute the implementation described in the embodiment of the method described in fig. 1 provided in the embodiments of the present invention, and may also execute the implementation of the data traffic testing apparatus described in fig. 2 in the embodiments of the present invention, which is not described herein again.
The embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium stores a computer program, where the computer program when executed by a processor implements the data flow testing method described in the embodiment corresponding to fig. 1, and may also implement the data flow testing device in the embodiment corresponding to fig. 2, which is not described herein again.
The computer readable storage medium may be an internal storage unit of the data flow testing device according to any of the foregoing embodiments, for example, a hard disk or a memory of the data flow testing device. The computer readable storage medium may also be an external storage device of the data flow testing device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the data flow testing device. Further, the computer readable storage medium may also include both an internal storage unit and an external storage device of the data flow testing device. The computer readable storage medium is used for storing the computer program and other programs and data required by the data flow testing device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a computer-readable storage medium, comprising several instructions for causing a server (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned computer-readable storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes. The computer readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
It is emphasized that to further guarantee the privacy and security of the data, the data may also be stored in a blockchain node. The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention.

Claims (7)

1. A data traffic testing method, applied to a server, the method comprising:
Acquiring one or more data requests sent to a server by a client in a specified time range and actual response messages sent to the client by the server for each data request;
determining the obtained actual response messages corresponding to the data requests as service units;
simulating and responding to the data requests in each service unit, and performing playback test on the data flow corresponding to the data requests in each service unit to obtain a simulated response message corresponding to the data requests in each service unit;
content comparison is carried out on each simulation response message and the actual response message in each service unit, and when comparison results are consistent, the playback test of the data flow corresponding to the data request in each service unit is determined to be successful;
before the content comparison between the analog response message in each service unit and the actual response message in each service unit, the method further comprises:
acquiring one or more pieces of address information pre-led in and menu information to which the address information belongs from a preset rule list;
Determining a comparison rule of each address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rule is used for indicating and comparing the message length of each response message and one or more designated fields in the message;
the content comparison of the analog response message in each service unit and the actual response message in each service unit includes:
obtaining the length of the simulated response message corresponding to the comparison rule and the designated field in the simulated response message in each service unit, and the length of the actual response message corresponding to the comparison rule and the designated field in the actual response message in each service unit;
comparing the length of the simulated response message corresponding to the comparison rule in the simulated response message in each service unit with the length of the actual response message corresponding to the comparison rule in the actual response message in each service unit; comparing each specified field corresponding to the comparison rule in the simulated response message in each service unit with each specified field corresponding to the comparison rule in the actual response message in each service unit;
And when the comparison results are consistent, determining that the playback test of the data flow corresponding to the data request in each service unit is successful, including:
when each specified field corresponding to the comparison rule in the simulated response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, and the simulated response message length is consistent with the actual response message length, determining that playback test of the flow of the data request in each service unit is successful;
and when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, and/or the simulated response message length is inconsistent with the actual response message length, determining that playback test of the flow of the data request in each service unit is unsuccessful.
2. The method according to claim 1, wherein after determining the obtained actual response message corresponding to each data request and each data request as a service unit, the method further comprises:
Acquiring the sending time of each data request, and sequencing each service unit according to the sequence of the sending time;
the simulating responding to the data request in each service unit comprises the following steps:
and sequentially simulating and responding to the data requests in the service units according to the sequence of the service units.
3. The method of claim 1, wherein said comparing said analog response message in each of said service units with said actual response message in each of said service units comprises:
analyzing the simulation response messages in each service unit to obtain first keywords corresponding to the simulation response messages in each service unit;
analyzing the actual response messages in each service unit to obtain second keywords corresponding to the actual response messages in each service unit;
and comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit according to the first keyword and the second keyword.
4. A method according to claim 3, wherein said comparing the content of the simulated response message in each of the service units with the actual response message in each of the service units according to the first key and the second key comprises:
Acquiring a first field corresponding to the first keyword in the analog response message in each service unit and a second field corresponding to the second keyword in the actual response message in each service unit;
sorting the first keywords and the second keywords according to the sequence of each letter in the alphabet;
and comparing the content of the first field with the content of the second field according to the ordering of the first keyword and the second keyword.
5. A data flow testing device, comprising:
the system comprises an acquisition unit, a server and a storage unit, wherein the acquisition unit is used for acquiring one or more data requests sent to the server by a client in a specified time range and actual response messages sent to the client by the server for each data request;
the determining unit is used for determining the obtained data requests and the actual response messages corresponding to the data requests as service units;
the test unit is used for simulating and responding to the data requests in each service unit, and performing playback test on the data flow corresponding to the data requests in each service unit to obtain simulated response messages corresponding to the data requests in each service unit;
The comparison unit is used for comparing the content of the simulated response message in each service unit with the content of the actual response message in each service unit, and determining that the playback test of the data flow corresponding to the data request in each service unit is successful when the comparison results are consistent;
the comparison unit is further configured to, before comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit:
acquiring one or more pieces of address information pre-led in and menu information to which the address information belongs from a preset rule list;
determining a comparison rule of each address information according to one or more address information and menu information to which the address information belongs, wherein the comparison rule is used for indicating and comparing the message length of each response message and one or more designated fields in the message;
the comparison unit is specifically configured to, when comparing the content of the analog response message in each service unit with the content of the actual response message in each service unit:
obtaining the length of the simulated response message corresponding to the comparison rule and the designated field in the simulated response message in each service unit, and the length of the actual response message corresponding to the comparison rule and the designated field in the actual response message in each service unit;
Comparing the length of the simulated response message corresponding to the comparison rule in the simulated response message in each service unit with the length of the actual response message corresponding to the comparison rule in the actual response message in each service unit; comparing each specified field corresponding to the comparison rule in the simulated response message in each service unit with each specified field corresponding to the comparison rule in the actual response message in each service unit;
when the comparison unit determines that the playback test of the data flow corresponding to the data request in each service unit is successful, the comparison unit is specifically configured to:
when each specified field corresponding to the comparison rule in the simulated response message in each service unit is consistent with each specified field corresponding to the comparison rule in the actual response message in each service unit, and the simulated response message length is consistent with the actual response message length, determining that playback test of the flow of the data request in each service unit is successful;
And when one specified field is inconsistent with each specified field corresponding to the comparison rule in the actual response message in each service unit in each specified field corresponding to the comparison rule in the simulated response message in each service unit, and/or the simulated response message length is inconsistent with the actual response message length, determining that playback test of the flow of the data request in each service unit is unsuccessful.
6. A server comprising a processor and a memory, wherein the memory is for storing a computer program, the processor being configured to invoke the computer program to perform the method of any of claims 1-4.
7. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program, which is executed by a processor to implement the method of any of claims 1-4.
CN202111200623.XA 2021-10-14 2021-10-14 Data traffic testing method and device, server and storage medium Active CN113938408B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111200623.XA CN113938408B (en) 2021-10-14 2021-10-14 Data traffic testing method and device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111200623.XA CN113938408B (en) 2021-10-14 2021-10-14 Data traffic testing method and device, server and storage medium

Publications (2)

Publication Number Publication Date
CN113938408A CN113938408A (en) 2022-01-14
CN113938408B true CN113938408B (en) 2023-07-11

Family

ID=79279468

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111200623.XA Active CN113938408B (en) 2021-10-14 2021-10-14 Data traffic testing method and device, server and storage medium

Country Status (1)

Country Link
CN (1) CN113938408B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002011B (en) * 2022-06-16 2023-12-08 湖北华中电力科技开发有限责任公司 Flow bidirectional test method and device, electronic equipment and storage medium
CN115643314B (en) * 2022-10-21 2024-02-23 中电金信软件有限公司 System alternating information confirmation method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8856211B1 (en) * 2010-09-30 2014-10-07 Amazon Technologies, Inc. Flexible network testing
CN111010316A (en) * 2019-12-17 2020-04-14 广州唯品会信息科技有限公司 Flow playback method, device and system
WO2021042914A1 (en) * 2019-09-02 2021-03-11 深圳壹账通智能科技有限公司 Test data generation method and apparatus, computer device and storage medium
CN112491659A (en) * 2020-12-02 2021-03-12 广州品唯软件有限公司 Flow playback test method and device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6528672B2 (en) * 2015-12-17 2019-06-12 東芝三菱電機産業システム株式会社 Playback simulator playback test system
CN112597015A (en) * 2020-12-17 2021-04-02 中国建设银行股份有限公司 System test method, device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8856211B1 (en) * 2010-09-30 2014-10-07 Amazon Technologies, Inc. Flexible network testing
WO2021042914A1 (en) * 2019-09-02 2021-03-11 深圳壹账通智能科技有限公司 Test data generation method and apparatus, computer device and storage medium
CN111010316A (en) * 2019-12-17 2020-04-14 广州唯品会信息科技有限公司 Flow playback method, device and system
CN112491659A (en) * 2020-12-02 2021-03-12 广州品唯软件有限公司 Flow playback test method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113938408A (en) 2022-01-14

Similar Documents

Publication Publication Date Title
CN107870860B (en) Buried point verification system and method
CN113938408B (en) Data traffic testing method and device, server and storage medium
CN109976995B (en) Method and apparatus for testing
CN112860841A (en) Text emotion analysis method, device and equipment and storage medium
CN111813701B (en) HTTP-based interface testing method and device, computer equipment and storage medium
CN111343162B (en) System secure login method, device, medium and electronic equipment
CN109376534B (en) Method and apparatus for detecting applications
CN111488995A (en) Method and apparatus for evaluating a joint training model
CN111460394A (en) Copyright file verification method and device and computer readable storage medium
CN113438134A (en) Request message processing method, device, server and medium
CN111629063A (en) Block chain based distributed file downloading method and electronic equipment
CN113536770B (en) Text analysis method, device and equipment based on artificial intelligence and storage medium
CN114116108A (en) Dynamic rendering method, device, equipment and storage medium
CN114185766A (en) Code detection method and device, electronic equipment and storage medium
CN110020040B (en) Method, device and system for querying data
CN113780580B (en) Data analysis method, device, equipment and storage medium based on machine learning
CN111143650A (en) Method, device, medium and electronic equipment for acquiring page data
CN112989044B (en) Text classification method, device, equipment and storage medium
CN112487771B (en) Report generation method, report generation device and terminal
CN111190824B (en) Monitoring method, device, terminal equipment and storage medium
CN110517010B (en) Data processing method, system and storage medium
CN109241537B (en) Information processing method and information processing apparatus
CN111859985A (en) AI customer service model testing method, device, electronic equipment and storage medium
CN113641576B (en) Database testing method and device and terminal equipment
CN117171185B (en) Logistics data changing method and related equipment based on industrial identification

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant