CN114338846A - Message testing method and device - Google Patents

Message testing method and device Download PDF

Info

Publication number
CN114338846A
CN114338846A CN202011061448.6A CN202011061448A CN114338846A CN 114338846 A CN114338846 A CN 114338846A CN 202011061448 A CN202011061448 A CN 202011061448A CN 114338846 A CN114338846 A CN 114338846A
Authority
CN
China
Prior art keywords
field
noise
message
response message
operating environment
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.)
Pending
Application number
CN202011061448.6A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011061448.6A priority Critical patent/CN114338846A/en
Publication of CN114338846A publication Critical patent/CN114338846A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a message testing method and device. The message testing method comprises the following steps: the second response message is generated based on the code test version and the request message in a noise-free operating environment in advance, and the third response message is generated based on the code test version and the request message in a noise-free operating environment. When testing the code development version, firstly inputting a request message into the code development version under a first operation environment to generate a first operation environment, then determining a field to be determined based on a difference field between a first response message and a second response message, removing a noise field in the field to be determined by comparing the field to be determined with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method avoids processing more undetermined fields, can reduce the influence of the operating environment on code testing based on the pre-generated noise fields, obtains abnormal fields with lower redundancy, reduces the data processing amount, and improves the testing efficiency.

Description

Message testing method and device
Technical Field
The present application relates to the field of computer and communication technologies, and in particular, to a method and an apparatus for testing a message.
Background
In many test scenarios, code or the state of an operating system is typically evaluated based on test results. In practical applications, because the versions of the codes are different and the testing environments are different, many different testing results are easy to generate, and the results often need much manual labor to be checked to find out real abnormal data. Especially in the case of a large amount of input data or output data and a large number of data types, this method will require a large amount of time and cost, resulting in a problem of low test efficiency.
Disclosure of Invention
The embodiment of the application provides a message testing method and device, so that the influence of a running environment on code testing can be reduced at least to a certain extent on the basis of a pre-generated noise field, an abnormal field with low redundancy is obtained, the data processing amount is reduced, and the testing efficiency is improved.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
According to an aspect of the embodiments of the present application, a method for testing a packet is provided, including: inputting a request message into a code development version under a first operating environment to generate a first response message, wherein the first operating environment represents an operating environment containing noise; acquiring a second response message generated based on the code test version and the request message in a second operating environment which is regarded as noiseless; determining a field to be determined based on a difference field between the first response message and the second response message; acquiring a noise field generated by a difference field between the second response message and a third response message, wherein the third response message is generated based on the code test version and the request message in the first operating environment; and removing a noise field existing in the undetermined field to obtain an abnormal field generated by the code development version.
In some embodiments of the present application, based on the foregoing solution, before the obtaining a second response packet generated based on the code test version and the request packet in a second runtime environment considered to be noise-free, the method further includes: and inputting the request message into the code test version under the second operating environment, and outputting the corresponding noiseless second response message of the request message under the second operating environment.
In some embodiments of the present application, based on the foregoing solution, before the obtaining the noise field generated by the difference field between the second response packet and the third response packet, the method further includes: inputting the request message into the code test version under the first operating environment, and outputting a third response message corresponding to the request message under the first operating environment; determining the noise field based on a difference field between the second reply packet and the third reply packet.
In some embodiments of the present application, based on the foregoing scheme, the determining the noise field based on the difference field between the second response packet and the third response packet includes: identifying field names with different field values as the difference fields based on the field names and the field values in the second response message and the field names and the field values in the third response message; adding the difference field to the noise field.
In some embodiments of the present application, based on the foregoing scheme, the determining the noise field based on the difference field between the second response packet and the third response packet includes: if a field not included in the second response message exists in the third response message, taking the field as the difference field; adding the difference field to the noise field.
In some embodiments of the application, based on the foregoing solution, after determining the noise field based on the difference field between the second response packet and the third response packet, the method further includes: acquiring a target field name corresponding to the noise field; and marking the target field name.
In some embodiments of the present application, based on the foregoing solution, after the determining the noise field based on the difference field between the second response packet and the third response packet, the method further includes at least one of the following steps: based on the selected field name in the acquired field deleting instruction, deleting the noise field corresponding to the selected field name from the original noise field; and adding the newly added field name into the noise field based on the newly added field name in the acquired field adding instruction.
In some embodiments of the present application, based on the foregoing scheme, the noise field includes at least one of the following fields: a time field, an address field, or an account identification field.
In some embodiments of the present application, based on the foregoing scheme, the removing, based on a noise field generated in advance, a noise field existing in the field to be determined to obtain an abnormal field further includes: and carrying out exception analysis based on the exception field to determine the reason of the exception.
According to an aspect of the embodiments of the present application, there is provided a device for testing a packet, including: the device comprises an input unit, a first response message and a second response message, wherein the input unit is used for inputting a request message into a code development version under a first operating environment, and the first operating environment represents an operating environment containing noise; a first obtaining unit, configured to obtain a second response packet generated based on the code test version and the request packet in a second operating environment regarded as noise-free; the undetermined unit is used for determining an undetermined field based on a difference field between the first response message and the second response message; a second obtaining unit, configured to obtain a noise field generated by a difference field between the second response packet and a third response packet, where the third response packet is generated in the first operating environment based on the code test version and the request packet; and the removing unit is used for removing the noise field existing in the undetermined field to obtain the abnormal field generated by the code development version.
In some embodiments of the present application, based on the foregoing scheme, the device for testing a packet further includes: and the first output unit is used for inputting the request message into the code test version under the second operating environment and outputting the noise-free second response message corresponding to the request message under the second operating environment.
In some embodiments of the present application, based on the foregoing scheme, the device for testing a packet further includes: a second output unit, configured to input the request packet into the code test version in the first operating environment, and output a third response packet corresponding to the request packet in the first operating environment; a noise determination unit, configured to determine the noise field based on a difference field between the second response packet and the third response packet.
In some embodiments of the present application, based on the foregoing scheme, the noise determination unit includes: a first difference identifying unit configured to identify, as the difference field, a field name corresponding to a field value that is different from the first field name, based on the field name and the field value in the first response message and the field name and the field value in the second response message; a first field adding unit for adding the difference field to the noise field.
In some embodiments of the present application, based on the foregoing scheme, the noise determination unit includes: a second difference identification unit, configured to, if a field that is not included in the second response message exists in the third response message, use the field as the difference field; a second field adding unit for adding the difference field to the noise field.
In some embodiments of the present application, based on the foregoing scheme, the device for testing a packet further includes: the field acquisition unit is used for acquiring a target field name corresponding to the noise field; and the field marking unit is used for marking the target field name.
In some embodiments of the present application, based on the foregoing solution, the message testing apparatus is further configured to perform at least one of the following steps: based on the selected field name in the acquired field deleting instruction, deleting the noise field corresponding to the selected field name from the original noise field; and adding the newly added field name into the noise field based on the newly added field name in the acquired field adding instruction.
In some embodiments of the present application, based on the foregoing scheme, the noise field includes at least one of the following fields: a time field, an address field, or an account identification field.
In some embodiments of the present application, based on the foregoing scheme, the device for testing a packet further includes: and the abnormality analysis unit is used for carrying out abnormality analysis based on the abnormality field and determining the reason of the abnormality.
According to an aspect of an embodiment of the present application, there is provided a computer-readable medium on which a computer program is stored, the computer program, when executed by a processor, implementing the method of message testing as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic device including: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of message testing as described in the embodiments above.
According to an aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the message testing method provided in the above-mentioned various optional implementation modes.
In the technical solutions provided in some embodiments of the present application, a second response packet is generated based on a code test version and a request packet in a noise-free operating environment in advance, and a third response packet is generated based on the code test version and the request packet in a noise-free operating environment at the same time, so as to obtain test data in the noise-free environment and the noise-free environment, respectively. When testing the code development version, firstly inputting a request message into the code development version under a first operation environment to generate a first operation environment, then determining a field to be determined based on a difference field between a first response message and a second response message, removing a noise field in the field to be determined by comparing the field to be determined with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method avoids processing more undetermined fields, can reduce the influence of the operating environment on code testing based on the pre-generated noise fields, obtains abnormal fields with lower redundancy, reduces the data processing amount, and improves the testing efficiency.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which aspects of embodiments of the present application may be applied;
FIG. 2 schematically illustrates a flow diagram of a method of message testing according to one embodiment of the present application;
FIG. 3 schematically illustrates a diagram of generating a reply message in a first runtime environment, according to an embodiment of the present application;
FIG. 4 schematically illustrates a diagram of generating a reply message in a second runtime environment, according to an embodiment of the present application;
FIG. 5 schematically illustrates a schematic diagram of determining a pending field according to one embodiment of the present application;
FIG. 6 schematically illustrates a flow diagram for determining a noise field according to an embodiment of the present application;
FIG. 7 is a schematic diagram illustrating the generation of a reply message based on a first operating environment, according to an embodiment of the present application;
FIG. 8 schematically illustrates a diagram of generating a noise field according to an embodiment of the present application;
FIG. 9 schematically illustrates a diagram of identifying an exception field according to one embodiment of the present application;
FIG. 10 schematically illustrates an apparatus for message testing according to one embodiment of the present application;
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the application.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied.
As shown in fig. 1, the system architecture may include a terminal device (e.g., one or more of a smartphone 101, a tablet computer 102, and a portable computer 103 shown in fig. 1, but may also be a desktop computer, etc.), a network 104, and a server 105. The network 104 serves as a medium for providing communication links between terminal devices and the server 105. Network 104 may include various connection types, such as wired communication links, wireless communication links, and so forth.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
A user may use a terminal device to interact with the server 105 over the network 104 to receive or send messages or the like. The server 105 may be a server that provides various services. For example, a user uploads a request message to the server 105 by using the terminal device 103 (or the terminal device 101 or 102), and the server 105 may input the request message into a code development version in a first operating environment to generate a first response message, where the first operating environment represents an operating environment containing noise; acquiring a second response message generated based on the code test version and the request message in a second operating environment which is regarded as noiseless; determining a field to be determined based on a difference field between the first response message and the second response message; acquiring a noise field generated by a difference field between a second response message and a third response message, wherein the third response message is generated based on a code test version and a request message in a first operating environment; and removing a noise field existing in the field to be determined to obtain an abnormal field generated by the code development version.
According to the scheme, the second response message is generated on the basis of the code test version and the request message in a noise-free operating environment in advance, and the third response message is generated on the basis of the code test version and the request message in a noise-free operating environment, so that the test data in the noise-free environment and the test data in the noise-free environment are obtained respectively. When testing the code development version, firstly inputting a request message into the code development version under a first operation environment to generate a first operation environment, then determining a field to be determined based on a difference field between a first response message and a second response message, removing a noise field in the field to be determined by comparing the field to be determined with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method avoids processing more undetermined fields, can reduce the influence of the operating environment on code testing based on the pre-generated noise fields, obtains abnormal fields with lower redundancy, reduces the data processing amount, and improves the testing efficiency.
It should be noted that the method for message testing provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the device for message testing is generally disposed in the server 105. However, in other embodiments of the present application, the terminal device may also have a similar function as the server, so as to execute the method for testing a message provided in the embodiments of the present application.
The implementation details of the technical solution of the embodiment of the present application are set forth in detail below:
fig. 2 shows a flow diagram of a method of message testing, which may be performed by a server, which may be the server shown in fig. 1, according to an embodiment of the present application. Referring to fig. 2, the method for testing messages at least includes steps S210 to S250, which are described in detail as follows:
in step S210, a request message is input into a code development version in a first operating environment, and a first response message is generated, where the first operating environment represents an operating environment containing noise.
Fig. 3 is a schematic diagram illustrating generation of a response packet based on a first operating environment according to an embodiment of the present application.
As shown in fig. 3, in one embodiment of the present application, after the request message 320 is obtained, the request message 320 is input into the code development version 330 in the first operating environment through the testing tool 310 to generate a first response message 340.
Specifically, the first operating environment in the embodiment represents a noisy operating environment, and in the noisy operating environment, noise may also generate a corresponding noise result in the code development version, and the noise result is redundant data and disturbs analysis of the code development version. The noise in this embodiment is used to indicate that the result value returned in the interface service test may return different values, such as a timestamp or a call IP value, depending on the test environment and time, but the returned value of the field does not affect the correctness of the test result.
In this embodiment, the request message includes request information for running a code development version. The first reply message includes run data generated after running the code development version, such as: VX; VY 2; VZ1, wherein the response message includes field names and field values, for example, the field names RespX, RespY and RespZ, and the corresponding field values are VX, VY2 and VZ1, respectively.
In an embodiment of the present application, before the process of obtaining the second response message generated based on the code test version and the request message in the second runtime environment considered to be noise-free in step S220, the method further includes: and inputting the request message into the code test version under the second operation environment, and outputting a second noiseless response message corresponding to the request message under the second operation environment.
Fig. 4 is a schematic diagram illustrating generation of a response packet based on a second operating environment according to an embodiment of the present application.
As shown in fig. 4, in one embodiment of the present application, the second operating environment 430 corresponds to the first operating environment and represents a noise-free operating environment. In this embodiment, a second response message 440 is generated in advance in the second noise-free operating environment through the code test version 430 and the request message 420 based on the user request 410. The second response message 440 generated in this embodiment is a response message that does not carry noise.
For example, in this embodiment, the field name and the field value in the second response packet 440 may include: VX; VY is RespY; VZ is RespZ.
In step S220, a second response message generated based on the code test version and the request message in the second operating environment considered to be noise-free is obtained.
In one embodiment of the present application, after generating the first reply message, a second reply message is obtained. As described above, the second response message in the present embodiment is generated based on the code test version and the request message in the second operating environment considered to be noise-free.
In this embodiment, the second response packet may be stored in the test tool or the database, so that the test tool may directly call the second response packet to determine the noise field in the first response packet.
In step S230, a pending field is determined based on a difference field between the first response packet and the second response packet.
In an embodiment of the present application, after generating the first response packet and acquiring the second response packet, the first response packet is compared with the second response packet, and a difference field between the first response packet and the second response packet is determined to be used as an undetermined field.
Fig. 5 is a schematic diagram of determining a pending field according to an embodiment of the present application.
As shown in fig. 5, the first response packet 510 generated in this embodiment is: VX; VY 2; VZ1, and the obtained second response message 520 is: VX; VY is RespY; VZ is RespZ. The first response message 510 is compared with the second response message 520 to determine the difference fields RespY: VY2// VY and RespZ: VZ1// VZ, wherein RespY and RespZ are used as the pending fields in this embodiment.
In the above scheme, in this embodiment, by comparing the first response packet generated by the code development version in the noisy environment with the second response packet generated by the code test version in the noise-free environment, different packets are determined as undetermined fields, that is, the changed operation results are determined, and there may be a normal operation result or an abnormal operation result in the operation results.
In an embodiment of the present application, as shown in fig. 6, before the process of acquiring the noise field generated by the difference field between the second response packet and the third response packet in step S240, the method further includes steps S241 to S242:
in step S241, the request message is input into the code test version under the first operating environment, and a third response message corresponding to the request message under the first operating environment is output.
Fig. 7 is a schematic diagram of generating a response packet based on a first operating environment according to an embodiment of the present application.
As shown in fig. 7, in one embodiment of the present application, a corresponding third response message 740 is generated by the test tool 710 running 730 the code test version in the first runtime environment based on the request message 720. The third reply packet 740 generated in this embodiment may include: VX; VY 2; VZ is RespZ.
In step S242, a noise field is determined based on the difference field between the second response message and the third response message.
In an embodiment of the present application, in step S241, the process of determining the noise field based on the difference field between the second response packet and the third response packet specifically includes: identifying field names corresponding to different field values as difference fields based on the field names and the field values in the second response message and the field names and the field values in the third response message; the difference field is added to the noise field.
Fig. 8 is a schematic diagram of generating a noise field according to an embodiment of the present application.
As shown in fig. 8, in an embodiment of the present application, after generating a third response message, the third response message 810 is compared with the second response message 820 to determine a difference field RespY: VY2// VY (830), where RespY is used as a noise field in this embodiment.
In the above scheme, the code test version is determined by the code version based on the same code; obtaining different response messages in different operating environments, namely a second response message and a third response message; and comparing the two messages to determine a difference field therein, so as to determine the difference between the two operation environments through the difference field, namely when the second operation environment is taken as a noise-free environment, the difference field between the operation result of the corresponding noisy first operation environment and the operation result of the second operation environment is a noise field.
In one embodiment of the present application, the noise field includes at least one of the following fields: time field, address field or account identification field, etc., and noise field may be different due to different running environment, running time, etc., but these differences are not the main research objects in the testing process, and thus are eliminated to reduce the redundancy of the testing data.
In an embodiment of the present application, in step S241, the process of determining the noise field based on the difference field between the second response packet and the third response packet specifically includes: if the third response message contains a field which is not contained in the second response message, taking the field as a difference field; the difference field is added to the noise field. In the above manner, the newly generated field is also used as the noise field.
In an embodiment of the present application, after the step S241 of determining the noise field based on the difference field between the second response packet and the third response packet, the method further includes: acquiring a target field name corresponding to a noise field; the target field name is marked. By marking the field names of the noise fields, the noise fields can be directly identified when the noise fields exist in the generated test result in the subsequent test process, so that a tester can determine the noise fields.
In an embodiment of the present application, after the step S241 of determining the noise field based on the difference field between the second response packet and the third response packet, the method further includes: based on the selected field name in the obtained field deleting instruction, deleting the noise field corresponding to the selected field name from the original noise field; and adding the newly added field name into the noise field based on the newly added field name in the acquired field adding instruction.
In an embodiment of the present application, when there are many generated noise fields and there is a case of misjudgment therein, some fields, that is, selected field names, may be considered to be deleted, and then the noise field corresponding to the selected field name is deleted from the original noise field. In addition, when the computer does not recognize some noises in the test result or some fields do not need to be processed as abnormal fields, the fields are used as noise fields, namely new field names corresponding to the fields are added to the noise fields, so that the data can be directly eliminated from the subsequent test data. By the method, the correctness and the accuracy of the noise library are ensured, and the accuracy of noise identification and the accuracy of test data processing are improved.
In step S240, a noise field generated by a difference field between the second response packet and a third response packet is obtained, where the third response packet is generated based on the code test version and the request packet in the first operating environment.
In one embodiment of the application, after the third response message is generated based on the code test version and the request message in the first operating environment, and the noise fields are generated through the difference fields between the second response message and the third response message, the noise fields are obtained.
In this embodiment, the noise field may be stored in a test tool or a database, so that the test tool can directly call the noise field.
In step S250, the noise field existing in the field to be determined is removed, and the abnormal field generated by the code development version is obtained.
In an embodiment of the application, after the noise field is acquired, the noise field existing in the noise field is determined based on the undetermined field, the noise field existing in the undetermined field is removed, and the remaining field is used as an abnormal field generated by a code development version.
In an embodiment of the present application, after the process of removing a noise field existing in the field to be determined in step S250 and obtaining an abnormal field generated by the code development version, the method further includes: and performing exception analysis based on the exception field to determine the reason of the exception.
In an embodiment of the application, after removing the noise field in the to-be-determined field, the exception field in the to-be-determined field is left, so that the code development version is tested and analyzed according to the exception fields, and the exception reason of generating the exception field is obtained specifically where the problem occurs.
Fig. 9 is a schematic diagram of an exception field identification according to an embodiment of the present application.
As shown in fig. 9, in the recording process of the current network environment, that is, in the recording version 930 in the formal environment, we record the complete request message 920 and response packet corresponding to the user request 910, the response message includes field names and field values, for example, values VX, VY, and VZ corresponding to fields RespX, RespY, and RespZ of the response message a (940) in the figure, and the data set a is stored in the database, and this case is used as a test case.
The current network request message recorded in step 1 is played back to the current network recording version program once by the test tool 950 in the test environment 960, and the response message B (970) is stored in the database. Comparing the returned values of each response field of the response message a (940) and the response message B (970) one by one, if there is a difference in the field values, the field is a noise field, for example, in the response message a (940) and the response message B (970) in the figure, we compare RespX, RespY and RespZ to find that VX and VZ are the same, but the values corresponding to RespY are VY1 and VY, so RespY is recorded as a noise field, because the played back version is a recorded version but the environment and time are not consistent, if the request is successful, the difference field between the two is a noise field. A noise field is also considered to be present in response message B (970) if the response field is absent from response message a (940).
And (4) playing back the recorded existing network request message once in a 980 th version of a newly developed version program in the test environment, and storing a response message C (990) in a database. And comparing the difference fields in the request response packets of the response message A (940) and the response message C (940) with the noise field, and if the difference fields are not in the noise field, determining that the difference fields are abnormal fields. As shown in the figure, the VX value is found to be the same in comparison with the response message A (940), the response messages RespX, RespY and RespZ, but the VY2 and VZ1 values are different, and the value VZ1 of RespZ is determined to be an abnormal field because RespY is already marked as a noise field. In the embodiment, the noise field is found by automatic comparison, so that the cost of manually marking the noise field in different interface tests can be saved; in addition, because the identification is automatic, if the interface protocol is changed, the identification of the noise field can be automatically adjusted, and manual marking again is not needed.
According to the scheme, the second response message is generated on the basis of the code test version and the request message in a noise-free operating environment in advance, and the third response message is generated on the basis of the code test version and the request message in a noise-free operating environment, so that the test data in the noise-free environment and the test data in the noise-free environment are obtained respectively. When testing the code development version, firstly inputting a request message into the code development version under a first operation environment to generate a first operation environment, then determining a field to be determined based on a difference field between a first response message and a second response message, removing a noise field in the field to be determined by comparing the field to be determined with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method avoids processing more undetermined fields, can reduce the influence of the operating environment on code testing based on the pre-generated noise fields, obtains abnormal fields with lower redundancy, reduces the data processing amount, and improves the testing efficiency.
The following describes embodiments of an apparatus of the present application, which may be used to perform a method for testing a packet in the above embodiments of the present application. For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method for testing a message described above in the present application.
FIG. 10 shows a block diagram of an apparatus for message testing according to one embodiment of the present application.
Referring to fig. 10, an apparatus 1000 for message testing according to an embodiment of the present application includes: an input unit 1010, configured to input a request message into a code development version in a first operating environment, and generate a first response message, where the first operating environment represents an operating environment containing noise; a first obtaining unit 1020, configured to obtain a second response message generated based on the code test version and the request message in a second operating environment regarded as noise-free; an undetermined unit 1030, configured to determine an undetermined field based on a difference field between the first response packet and the second response packet; a second obtaining unit 1040, configured to obtain a noise field generated by a difference field between a second response message and a third response message, where the third response message is generated based on the code test version and the request message in the first operating environment; and a removing unit 1050, configured to remove a noise field existing in the field to be determined, to obtain an abnormal field generated by the code development version.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for message testing further includes: and the first output unit is used for inputting the request message into the code test version under the second operating environment and outputting a second noiseless response message corresponding to the request message under the second operating environment.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for message testing further includes: the second output unit is used for inputting the request message into the code test version under the first operating environment and outputting a third response message corresponding to the request message under the first operating environment; a noise determination unit, configured to determine a noise field based on a difference field between the second response packet and the third response packet.
In some embodiments of the present application, based on the foregoing scheme, the noise determination unit includes: a first difference identifying unit configured to identify, as a difference field, a field name corresponding to a field value that is different, based on the field name and the field value in the second response message and the field name and the field value in the third response message; a first field adding unit for adding the difference field to the noise field.
In some embodiments of the present application, based on the foregoing scheme, the noise determination unit includes: a second difference identification unit, configured to, if there is a field that is not included in the second response message in the third response message, use the field as a difference field; a second field adding unit for adding the difference field to the noise field.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for message testing further includes: the field acquisition unit is used for acquiring a target field name corresponding to the noise field; and the field marking unit is used for marking the target field name.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for message testing is further configured to perform at least one of the following steps: based on the selected field name in the obtained field deleting instruction, deleting the noise field corresponding to the selected field name from the original noise field; and adding the newly added field name into the noise field based on the newly added field name in the acquired field adding instruction.
In some embodiments of the present application, based on the foregoing scheme, the noise field includes at least one of the following fields: a time field, an address field, or an account identification field.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for message testing further includes: and the abnormality analysis unit is used for carrying out abnormality analysis based on the abnormality field and determining the reason of the abnormality.
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present application.
It should be noted that the computer system 1100 of the electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 11, a computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An Input/Output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output section 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a Network interface card such as a LAN (local area Network) card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to embodiments of the application, the processes described above with reference to the flow diagrams may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. When the computer program is executed by a Central Processing Unit (CPU)1101, various functions defined in the system of the present application are executed.
It should be noted that the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with a computer program embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for message testing, comprising:
inputting a request message into a code development version under a first operating environment to generate a first response message, wherein the first operating environment represents an operating environment containing noise;
acquiring a second response message generated based on the code test version and the request message in a second operating environment which is regarded as noiseless;
determining a field to be determined based on a difference field between the first response message and the second response message;
acquiring a noise field generated by a difference field between the second response message and a third response message, wherein the third response message is generated based on the code test version and the request message in the first operating environment;
and removing a noise field existing in the undetermined field to obtain an abnormal field generated by the code development version.
2. The method of claim 1, wherein prior to obtaining a second reply message generated based on a code test version and the request message in a second runtime environment considered noise-free, the method further comprises:
and inputting the request message into the code test version under the second operating environment, and outputting the corresponding noiseless second response message of the request message under the second operating environment.
3. The method of claim 1, wherein prior to obtaining the noise field generated by the difference field between the second response packet and the third response packet, the method further comprises:
inputting the request message into the code test version under the first operating environment, and outputting a third response message corresponding to the request message under the first operating environment;
determining the noise field based on a difference field between the second reply packet and the third reply packet.
4. The method of claim 3, wherein determining the noise field based on a difference field between the second reply packet and the third reply packet comprises:
identifying field names with different field values as the difference fields based on the field names and the field values in the second response message and the field names and the field values in the third response message;
adding the difference field to the noise field.
5. The method of claim 3, wherein determining the noise field based on a difference field between the second reply packet and the third reply packet comprises:
if a field not included in the second response message exists in the third response message, taking the field as the difference field;
adding the difference field to the noise field.
6. The method of claim 3, wherein after determining the noise field based on a difference field between the second reply message and the third reply message, the method further comprises:
acquiring a target field name corresponding to the noise field;
and marking the target field name.
7. The method of claim 3, wherein after determining the noise field based on a difference field between the second reply packet and the third reply packet, the method further comprises at least one of:
based on the selected field name in the acquired field deleting instruction, deleting the noise field corresponding to the selected field name from the original noise field;
and adding the newly added field name into the noise field based on the newly added field name in the acquired field adding instruction.
8. The method of claim 1, wherein the noise field comprises at least one of: a time field, an address field, or an account identification field.
9. The method of claim 1, wherein after removing a noise field existing in the field to be determined and obtaining an exception field generated by the code development version, further comprising:
and carrying out exception analysis based on the exception field to determine the reason of the exception.
10. An apparatus for message testing, comprising:
the device comprises an input unit, a processing unit and a processing unit, wherein the input unit is used for inputting a request message into a code development version under a first operating environment and generating a first response message, and the first operating environment represents an operating environment containing noise;
a first obtaining unit, configured to obtain a second response packet generated based on the code test version and the request packet in a second operating environment regarded as noise-free;
the undetermined unit is used for determining an undetermined field based on a difference field between the first response message and the second response message;
a second obtaining unit, configured to obtain a noise field generated by a difference field between the second response packet and a third response packet, where the third response packet is generated in the first operating environment based on the code test version and the request packet;
and the removing unit is used for removing the noise field existing in the undetermined field to obtain the abnormal field generated by the code development version.
CN202011061448.6A 2020-09-30 2020-09-30 Message testing method and device Pending CN114338846A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011061448.6A CN114338846A (en) 2020-09-30 2020-09-30 Message testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011061448.6A CN114338846A (en) 2020-09-30 2020-09-30 Message testing method and device

Publications (1)

Publication Number Publication Date
CN114338846A true CN114338846A (en) 2022-04-12

Family

ID=81011126

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011061448.6A Pending CN114338846A (en) 2020-09-30 2020-09-30 Message testing method and device

Country Status (1)

Country Link
CN (1) CN114338846A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297041A (en) * 2022-07-29 2022-11-04 深圳前海微众银行股份有限公司 Data verification method and device for flow playback

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297041A (en) * 2022-07-29 2022-11-04 深圳前海微众银行股份有限公司 Data verification method and device for flow playback
CN115297041B (en) * 2022-07-29 2024-01-02 深圳前海微众银行股份有限公司 Data verification method and device for flow playback

Similar Documents

Publication Publication Date Title
CN108897691B (en) Data processing method, device, server and medium based on interface simulation service
CN108073519B (en) Test case generation method and device
CN110764945A (en) Crash log processing method, device, equipment and storage medium
CN109815119B (en) APP link channel testing method and device
CN111324441A (en) Operating environment switching method and device, computer equipment and storage medium
US20170310566A1 (en) System and method for detecting system's performance regression
CN109828859B (en) Mobile terminal memory analysis method and device, storage medium and electronic equipment
CN110955409A (en) Method and device for creating resources on cloud platform
CN110046086B (en) Expected data generation method and device for test and electronic equipment
CN114338846A (en) Message testing method and device
CN115203061B (en) Interface automation test method and device, electronic equipment and storage medium
CN109542743B (en) Log checking method and device, electronic equipment and computer readable storage medium
CN111338958A (en) Parameter generation method and device of test case and terminal equipment
CN115022201B (en) Data processing function test method, device, equipment and storage medium
CN113377648B (en) Software system diagnosis method, device, electronic equipment and computer readable medium
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN110716859A (en) Method for automatically pushing test cases for modified codes and related device
CN112131611B (en) Data correctness verification method, device, equipment, system and storage medium
CN110866492B (en) Baseline branch identification method and device and computer system
CN115129575A (en) Code coverage result generation method and device
CN111679885A (en) Method, device, medium and electronic equipment for determining virtual machine drift
CN113760631A (en) Page loading duration determination method, device, equipment and storage medium
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN111176718A (en) Script online method and device, storage medium and electronic equipment
CN116661758B (en) Method, device, electronic equipment and medium for optimizing log framework configuration

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