[go: up one dir, main page]

CN114338846B - Message testing method and device - Google Patents

Message testing method and device Download PDF

Info

Publication number
CN114338846B
CN114338846B CN202011061448.6A CN202011061448A CN114338846B CN 114338846 B CN114338846 B CN 114338846B CN 202011061448 A CN202011061448 A CN 202011061448A CN 114338846 B CN114338846 B CN 114338846B
Authority
CN
China
Prior art keywords
field
noise
message
response message
difference
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
CN202011061448.6A
Other languages
Chinese (zh)
Other versions
CN114338846A (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.)
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/CN114338846B/en
Publication of CN114338846A publication Critical patent/CN114338846A/en
Application granted granted Critical
Publication of CN114338846B publication Critical patent/CN114338846B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method and a device for testing a message. 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 the noiseless operation environment in advance, and the third response message is generated based on the code test version and the request message in the noiseless operation environment. When testing the code development version, firstly inputting the request message into the code development version under the first operation environment to generate the first operation environment, then determining the undetermined field based on the difference field between the first response message and the second response message, removing the noise field in the undetermined field by comparing the undetermined field and the noise field, and finally obtaining the abnormal field corresponding to the code development version. The method and the device avoid processing more undetermined fields, can reduce the influence of the running environment on the code test based on the pre-generated noise fields, obtain the abnormal fields with lower redundancy, reduce the data processing amount and improve the test efficiency.

Description

Message testing method and device
Technical Field
The application relates to the technical field of computers and communication, in particular to a method and a device for testing messages.
Background
In many test scenarios, the status of a code or running system is typically evaluated based on test results. In practical application, because the versions of the codes are different and the test environments are different, a plurality of different test results are easy to generate, and the results often need a plurality of manual labor to check so as to find 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 approach will require a large time and cost, resulting in a problem of low test efficiency.
Disclosure of Invention
The embodiment of the application provides a method and a device for testing a message, which can further reduce the influence of an operation environment on code testing based on a pre-generated noise field to at least a certain extent, obtain an abnormal field with lower redundancy, reduce data processing amount and improve testing efficiency.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of the embodiment of the present application, there is provided a method for testing a message, including: inputting a request message into a code development version under a first running environment to generate a first response message, wherein the first running environment represents a running environment containing noise; acquiring a second response message generated based on the code test version and the request message in a second running environment regarded as noise-free; determining a pending field based on a difference field between the first reply message and the second reply message; acquiring a noise field generated through 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 operation environment; and removing noise fields in the undetermined fields to obtain abnormal fields generated by the code development version.
In some embodiments of the present application, based on the foregoing solution, the obtaining, before the second response message generated based on the code test version and the request message in the second operating environment considered to be noise-free, the method further includes: and inputting the request message into the code test version in the second operation environment, and outputting the corresponding noiseless second response message of the request message in the second operation environment.
In some embodiments of the present application, before the obtaining the noise field generated by the difference field between the second reply message and the third reply message, the method further includes: inputting the request message into the code test version in the first operation environment, and outputting a third response message corresponding to the request message in the first operation environment; and determining the noise field based on a difference field between the second response message and the third response message.
In some embodiments of the present application, based on the foregoing solution, the determining the noise field based on a difference field between the second reply message and the third reply message includes: 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, identifying the field names corresponding to the field values which are different as the difference fields; the difference field is added to the noise field.
In some embodiments of the present application, based on the foregoing solution, the determining the noise field based on a difference field between the second reply message and the third reply message includes: if a field which is not contained in the second response message exists in the third response message, the field is used as the difference field; the difference field is added to the noise field.
In some embodiments of the present application, based on the foregoing solution, after determining the noise field based on a difference field between the second reply message and the third reply message, 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 determining the noise field based on a difference field between the second reply message and the third reply message, the method further includes at least one step of: deleting a noise field corresponding to the selected field name from the original noise field based on the selected field name in the acquired field deleting instruction; 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 application, based on the foregoing, 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 removing, based on a pre-generated noise field, a noise field existing in the pending field, to obtain an abnormal field, further includes: and carrying out exception analysis based on the exception field, and determining the reason of the occurrence of the exception.
According to an aspect of an embodiment of the present application, there is provided a device for testing a packet, including: the input unit is used for inputting the request message into a code development version under a first running environment, wherein the first running environment represents a running environment containing noise; the first acquisition unit is used for acquiring a second response message generated based on the code test version and the request message in a second running environment which is regarded as noiseless; a pending unit, configured to determine a pending field based on a difference field between the first response packet and the second response packet; the second obtaining unit is used for obtaining a noise field generated through a difference field between the second response message and a third response message, and the third response message is generated based on the code test version and the request message in the first running environment; and the removing unit is used for removing noise fields in the undetermined fields to obtain abnormal fields generated by the code development version.
In some embodiments of the present application, based on the foregoing solution, the apparatus for testing a packet further includes: the first output unit is used for inputting the request message into the code test version in the second operation environment and outputting the second response message without noise corresponding to the request message in the second operation environment.
In some embodiments of the present application, based on the foregoing solution, the apparatus for testing a packet further includes: the second output unit is used for inputting the request message into the code test version in the first operation environment and outputting a third response message corresponding to the request message in the first operation environment; and the noise determining unit is used for determining the noise field based on the difference field between the second response message and the third response message.
In some embodiments of the present application, based on the foregoing scheme, the noise determining unit includes: a first difference identifying unit, configured to identify, as the difference field, a field name corresponding to a field value different from a field name and a field value in the second response packet, and a field name and a field value in the third response packet; a first field adding unit, configured to add the difference field to the noise field.
In some embodiments of the present application, based on the foregoing scheme, the noise determining unit includes: a second difference identifying unit, configured to, if, in the third response packet, there is a field that is not included in the second response packet, take the field as the difference field; and a second field adding unit configured to add the difference field to the noise field.
In some embodiments of the present application, based on the foregoing solution, the apparatus for testing a packet further includes: a field obtaining unit, configured to obtain 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 for testing a packet is further configured to perform at least one of the following steps: deleting a noise field corresponding to the selected field name from the original noise field based on the selected field name in the acquired field deleting instruction; 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 application, based on the foregoing, 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 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 abnormality.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method of packet testing as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic apparatus including: one or more processors; and 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 for packet testing as described in the above embodiments.
According to an aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the method of message testing provided in the various alternative implementations described above.
In the technical solutions provided in some embodiments of the present application, 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 the noise-free operating environment at the same time, so as to obtain test data in the noise-free and noise-free environments, respectively. When testing the code development version, firstly inputting a request message into the code development version under the first operation environment to generate the first operation environment, then determining a pending field based on a difference field between the first response message and the second response message, removing a noise field in the pending field by comparing the pending field with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method and the device avoid processing more undetermined fields, can reduce the influence of the running environment on the code test based on the pre-generated noise fields, obtain the abnormal fields with lower redundancy, reduce the data processing amount and improve the test 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 as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the application may be applied;
FIG. 2 schematically illustrates a flow chart of a method of message testing according to one embodiment of the application;
FIG. 3 schematically illustrates a diagram of generating a reply message in a first operating environment according to one embodiment of the application;
FIG. 4 schematically illustrates a diagram of generating a reply message in a second operating environment according to one embodiment of the application;
FIG. 5 schematically illustrates a diagram of determining pending fields according to one embodiment of the application;
FIG. 6 schematically illustrates a flow diagram for determining noise fields according to one embodiment of the application;
FIG. 7 schematically illustrates generating a reply message based on a first operating environment according to one embodiment of the application;
FIG. 8 schematically illustrates a schematic diagram of generating a noise field according to one embodiment of the application;
FIG. 9 schematically illustrates a schematic diagram of identifying exception fields according to one embodiment of the application;
FIG. 10 schematically illustrates a schematic diagram of an apparatus for message testing according to one embodiment of the application;
fig. 11 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many 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 the 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 application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they 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 order of actual execution may be changed according to actual situations.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the present application may be applied.
As shown in fig. 1, the system architecture may include a terminal device (such as one or more of the smartphone 101, tablet 102, and portable computer 103 shown in fig. 1, but of course, a desktop computer, etc.), a network 104, and a server 105. The network 104 is the medium used to provide communication links between the terminal devices and the server 105. The network 104 may include various connection types, such as wired communication links, wireless communication links, and the like.
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, the server 105 may be a server cluster formed by a plurality of servers.
A user may interact with the server 105 via the network 104 using a terminal device to receive or send messages or the like. The server 105 may be a server providing various services. For example, when the user uploads the request message to the server 105 by using the terminal device 103 (may also be the terminal device 101 or 102), the server 105 may input the request message into a code development version under a first running environment, and generate a first response message, where the first running environment represents a running environment containing noise; acquiring a second response message generated based on the code test version and the request message in a second running environment regarded as noise-free; determining a pending field based on a difference field between the first reply message and the second reply message; acquiring a noise field generated through 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 operation environment; and removing noise fields in the undetermined fields to obtain abnormal fields generated by the code development version.
According to the scheme, the second response message is generated based on the code test version and the request message in the noiseless operation environment in advance, and the third response message is generated based on the code test version and the request message in the noiseless operation environment at the same time, so that test data in the noiseless environment and test data in the noiseless environment are obtained respectively. When testing the code development version, firstly inputting a request message into the code development version under the first operation environment to generate the first operation environment, then determining a pending field based on a difference field between the first response message and the second response message, removing a noise field in the pending field by comparing the pending field with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method and the device avoid processing more undetermined fields, can reduce the influence of the running environment on the code test based on the pre-generated noise fields, obtain the abnormal fields with lower redundancy, reduce the data processing amount and improve the test efficiency.
It should be noted that, the method for testing a message provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the device for testing a message 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 packet provided by the embodiments of the present application.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
Fig. 2 shows a flow chart of a method of message testing, which may be performed by a server, which may be the server shown in fig. 1, according to one embodiment of the application. Referring to fig. 2, the method for testing a message at least includes steps S210 to S250, which are described in detail as follows:
In step S210, the request message is input into a code development version under a first running environment, and a first response message is generated, where the first running environment represents a running environment containing noise.
Fig. 3 is a schematic diagram of generating a response message 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 execution environment by the test tool 310 to generate the first response message 340.
Specifically, the first operating environment in this embodiment represents an operating environment containing noise, and in the noisy operating environment, the noise also generates a corresponding noise result in the code development version, where 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 during the interface service test returns different values, such as a timestamp or a call IP value, according to the test environment and time, but the return value of the field does not affect the correctness of the test result.
In this embodiment, the request message includes request information for running the code development version. The first reply message includes the running data generated after the running code development version, for example: respX VX; respY VY2; respZ VZ1, where the reply message includes field names and field values, for example, field names RespX, respY, and RespZ, and the corresponding field values are VX, VY2, and VZ1, respectively.
In one embodiment of the present application, before the process of acquiring the second response message generated based on the code test version and the request message in the second operating environment regarded as noise-free in step S220, the method further includes: and inputting the request message into a code test version under a second operation environment, and outputting a corresponding noiseless second response message of the request message under the second operation environment.
Fig. 4 is a schematic diagram of generating a response message based on the second operating environment according to the embodiment of the present application.
As shown in FIG. 4, in one embodiment of the application, the second operating environment 430 corresponds to the first operating environment, representing a noiseless operating environment. In this embodiment, in the noise-free second operating environment in advance, based on the user request 410, the second response message 440 is generated through the code test version 430 and the request message 420. The second response message 440 generated in this embodiment is a response message that does not carry noise.
Illustratively, the field names and field values in the second reply message 440 in this embodiment may include: respX VX; respY VY; respZ VZ.
In step S220, a second response message generated based on the code test version and the request message in the second operating environment regarded as noise-free is acquired.
In one embodiment of the application, after the first reply message is generated, a second reply message is obtained. As described above, the second response message in this embodiment is generated based on the code test version and the request message in the second operating environment regarded as noise-free.
In this embodiment, the second response message may be stored in the test tool or the database, so that the test tool directly invokes the second response message to determine the noise field in the first response message.
In step S230, the pending field is determined based on the difference field between the first reply message and the second reply message.
In one embodiment of the present application, after the first response message is generated and the second response message is obtained, the first response message and the second response message are compared, and a difference field between the first response message and the second response message is determined and used as a pending 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 message 510 generated in this embodiment is: respX VX; respY VY2; respZ VZ1, the second response message 520 obtained is: respX VX; respY VY; respZ VZ. The first reply message 510 is compared with the second reply message 520, and the difference fields RespY:vy2// VY and RespZ:vz1// VZ between the two are determined, and RespY and RespZ are used as pending fields in this embodiment.
In the above scheme, in this embodiment, the first response message generated by the code development version in the noisy environment is compared with the second response message generated by the code test version in the noiseless environment, and different messages are determined to be pending fields, that is, the changed operation results are determined, and normal operation results may exist in the operation results or abnormal operation results may exist in the operation results, and then the noise fields in the operation results are determined through noise identification in the subsequent steps, so that the abnormal fields in the operation results can be determined.
In one 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 reply message and the third reply message in step S240, the method further includes steps S241 to S242:
in step S241, the request message is input into the code test version in the first operating environment, and a third response message corresponding to the request message in the first operating environment is output.
Fig. 7 is a schematic diagram of generating a response message 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, based on the request message 720, a corresponding third reply message 740 is generated by the test tool 710 running the code test version in the first running environment 730. The third reply message 740 generated in this embodiment may include: respX VX; respY VY2; respZ VZ.
In step S242, a noise field is determined based on the difference field between the second response message and the third response message.
In one embodiment of the present application, the process of determining the noise field in step S241 based on the difference field between the second reply message and the third reply message specifically includes: 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, identifying the field name corresponding to the field value different as a difference field; 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 one embodiment of the present application, after generating a third reply message, the third reply message 810 is compared with the second reply message 820 to determine a difference field RespY:vy2// VY (830), and RespY is used as a noise field in this embodiment.
In the scheme, the code is based on the same code version, namely the code test version; in different operation environments, different response messages, namely a second response message and a third response message, are obtained; and comparing the two messages to determine a difference field, and determining the difference between the two operation environments through the difference field, namely when the second operation environment is used as a noise-free environment, the difference field between the operation result in the corresponding noisy first operation environment and the operation result in the second operation environment is the noise field.
In one embodiment of the application, the noise field includes at least one of the following fields: time field, address field or account identification field, etc., noise field may vary due to different running environments, running times, etc., but these differences are not the main study object in the testing process and are therefore rejected to reduce redundancy of the test data.
In one embodiment of the present application, the process of determining the noise field in step S241 based on the difference field between the second reply message and the third reply message 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 a noise field.
In one embodiment of the present application, after the process of determining the noise field based on the difference field between the second reply message and the third reply message in step S241, the method further includes: acquiring a target field name corresponding to the noise field; the destination field name is marked. By marking the field name of the noise field, the noise field can be directly identified in the later test process when the noise field exists in the generated test result, so that a tester can conveniently determine the noise field in the noise field.
In one embodiment of the present application, after the process of determining the noise field based on the difference field between the second reply message and the third reply message in step S241, the method further includes: deleting a noise field corresponding to the selected field name from the original noise field based on the selected field name in the acquired field deleting instruction; 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 one embodiment of the present application, when there are more noise fields generated and there is a misjudgment, some of the fields, i.e. the selected field names, may be considered deleted, and then the noise fields corresponding to the selected field names are deleted from the original noise fields. In addition, when the computer does not recognize some noise in the test result or some fields do not need to be processed as abnormal fields, the fields are used as noise fields, namely, the new field names corresponding to the fields are added into the noise fields, so that the data can be directly removed from the subsequent test data. Through the mode, the accuracy and the precision of the noise library are guaranteed, and the accuracy of noise identification and the accuracy of test data processing are further improved.
In step S240, a noise field generated by a difference field between the second response message and a third response message generated based on the code test version and the request message in the first operating environment is obtained.
In one embodiment of the present application, after generating a third response message based on the code test version and the request message in the first operating environment, and generating noise fields through a difference field between the second response message and the third response message, the noise fields are acquired.
In this embodiment, the noise field may be stored in a test tool or a database, so that the test tool directly invokes the noise field.
In step S250, noise fields existing in the undetermined fields are removed, and an exception field generated by the code development version is obtained.
In one embodiment of the present 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 fields are used as abnormal fields generated by the code development version.
In one embodiment of the present application, after the process of removing the noise field existing in the undetermined field in step S250 to obtain the exception field generated by the code development version, the method further includes: and carrying out exception analysis based on the exception field, and determining the reason of the occurrence of the exception.
In one embodiment of the application, after removing the noise field in the pending field, the exception field in the pending field remains to test and analyze the code development version for these exception fields to get the exception cause of where the problem specifically occurred resulting in the generation of the exception field.
Fig. 9 is a schematic diagram of identifying an exception field according to an embodiment of the present application.
As shown in fig. 9, in the recording process of the current network environment, i.e. 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, where the response message includes a field name and a field value, such as the values VX, VY, VZ corresponding to the field RespX, respY, respZ of the response message a (940) in the figure, and the data set a is stored in the database, and this use case is used as a test case.
The current network request message recorded in step 1 is played back once to the current network recorded version program in the test environment 960 by the test tool 950, and the response message B (970) is stored in the database. The reply message a (940), reply message B (970) each have a reply field and a return value of the reply field that are noise fields if there are different field values, as in reply message a (940), reply message B (970) in the figure we compare RespX, respY, respZ to find VX, VZ to be the same, but RespY to have different values VY1, VY, so record RespY is noise field because the playback version is recorded version but the environment and time are inconsistent, and if the request is successful, the difference field of the two is noise field. If a reply field is present in reply message B (970) that is not present in reply message A (940), it is also considered a noise field.
And playing back the recorded current network request message once in 980 version of the newly developed version program in the test environment, and storing the response message C (990) in a database. And comparing the difference fields in the request response packet 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, obtaining the abnormal field. As shown, the VX value is found to be the same as that found in response messages A (940) and RespX, respY, 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 fields are found by automatic comparison, so that the cost of manually marking the noise fields in different interface tests can be saved; in addition, because the identification is automatic, if the interface protocol is changed, the noise field identification can be automatically adjusted, and manual re-marking is not needed.
According to the scheme, the second response message is generated based on the code test version and the request message in the noiseless operation environment in advance, and the third response message is generated based on the code test version and the request message in the noiseless operation environment at the same time, so that test data in the noiseless environment and test data in the noiseless environment are obtained respectively. When testing the code development version, firstly inputting a request message into the code development version under the first operation environment to generate the first operation environment, then determining a pending field based on a difference field between the first response message and the second response message, removing a noise field in the pending field by comparing the pending field with the noise field, and finally obtaining an abnormal field corresponding to the code development version. The method and the device avoid processing more undetermined fields, can reduce the influence of the running environment on the code test based on the pre-generated noise fields, obtain the abnormal fields with lower redundancy, reduce the data processing amount and improve the test efficiency.
The following describes an embodiment of the apparatus of the present application, which may be used to perform the method for packet testing in the above embodiment of the present application. For details 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.
Fig. 10 shows a block diagram of an apparatus for message testing according to an embodiment of the application.
Referring to fig. 10, an apparatus 1000 for testing a message according to an embodiment of the present application includes: an input unit 1010, configured to input a request packet into a code development version under a first operating environment, and generate a first response packet, where the first operating environment represents an operating environment that contains noise; a first obtaining unit 1020, configured to obtain a second response packet generated based on the code test version and the request packet in the second operating environment considered as noise-free; a pending unit 1030 configured to determine a pending field based on a difference field between the first reply message and the second reply message; a second obtaining unit 1040, configured to obtain a noise field generated by a difference field between a second response packet and a third response packet, where the third response packet is generated based on a code test version and a request packet in the first operating environment; the removing unit 1050 is configured to remove a noise field existing in the undetermined field, and obtain an exception field generated by the code development version.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for testing a packet further includes: the first output unit is used for inputting the request message into the code test version in the second operation environment and outputting a corresponding noiseless second response message of the request message in the second operation environment.
In some embodiments of the present application, based on the foregoing solution, the apparatus 1000 for testing a packet further includes: the second output unit is used for inputting the request message into the code test version in the first operation environment and outputting a third response message corresponding to the request message in the first operation environment; and the noise determining unit is used for determining a noise field based on the difference field between the second response message and the third response message.
In some embodiments of the present application, based on the foregoing scheme, the noise determination unit includes: the first difference identifying unit is used for identifying the field names corresponding to the field values when the field values are different 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; 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: the second difference identifying unit is configured to take the field as a difference field if the field not included in the second response message exists in the third response message; and 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 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 apparatus 1000 for testing a packet is further configured to perform at least one of the following steps: deleting a noise field corresponding to the selected field name from the original noise field based on the selected field name in the acquired field deleting instruction; 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 application, based on the foregoing, the noise field includes at least one of the following: 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 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 abnormality.
Fig. 11 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the 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 impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 11, the computer system 1100 includes a central processing unit (Central Processing Unit, CPU) 1101 that 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 (RandomAccess Memory, RAM) 1103. In the RAM 1103, various programs and data required 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 section 1106 including a keyboard, a mouse, and the like; an output portion 1107 including a Cathode Ray Tube (CRT), a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), and a speaker, etc.; a storage section 1108 including a hard disk or the like; and a communication section 1109 including a network interface card such as a LAN (LocalArea Network ) card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. The drive 1110 is also connected to the I/O interface 1105 as needed. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is installed as needed on drive 1110, so that a computer program read therefrom is installed as needed into storage section 1108.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts 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 shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion 1109, and/or installed from the removable media 1111. When executed by a Central Processing Unit (CPU) 1101, performs the various functions defined in the system of the present application.
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. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any 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 (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 context of this document, 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 the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with a computer-readable computer program embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. 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. A computer program embodied on a 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 flowcharts 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. Where 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 involved 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 provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
According to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read from the computer-readable storage medium by a processor of a computer device, and executed by the processor, cause the computer device to perform the methods provided in the various alternative implementations described above.
As another aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the 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 application 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 application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (10)

1. A method for testing messages, comprising:
Inputting a request message into a code development version under a first running environment to generate a first response message, wherein the first running environment represents a running environment containing noise;
Acquiring a second response message generated based on the code test version and the request message in a second running environment regarded as noise-free;
determining a pending field based on a difference field between the first reply message and the second reply message;
acquiring a noise field generated through 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 operation environment;
and removing noise fields in the undetermined fields to obtain abnormal fields generated by the code development version.
2. The method of claim 1, wherein prior to obtaining a second reply message generated based on the code test version and the request message in a second operating environment deemed noiseless, the method further comprises:
and inputting the request message into the code test version in the second operation environment, and outputting the corresponding noiseless second response message of the request message in the second operation environment.
3. The method of claim 1, wherein prior to obtaining a noise field generated by a difference field between the second reply message and a third reply message, the method further comprises:
Inputting the request message into the code test version in the first operation environment, and outputting a third response message corresponding to the request message in the first operation environment;
And determining the noise field based on a difference field between the second response message and the third response message.
4. The method of claim 3, wherein determining the noise field based on a difference field between the second reply message and the third reply message comprises:
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, identifying the field names corresponding to the field values which are different as the difference fields;
the difference field is added to the noise field.
5. The method of claim 3, wherein determining the noise field based on a difference field between the second reply message and the third reply message comprises:
If a field which is not contained in the second response message exists in the third response message, the field is used as the difference field;
the difference field is added to the noise field.
6. A method according to 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. A method according to 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 at least one of:
Deleting a noise field corresponding to the selected field name from the original noise field based on the selected field name in the acquired field deleting instruction;
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 the following fields: a time field, an address field, or an account identification field.
9. The method of claim 1, wherein removing noise fields present in the pending field to obtain an exception field generated by the code development version further comprises:
and carrying out exception analysis based on the exception field, and determining the reason of the occurrence of the exception.
10. A device for testing messages, comprising:
The input unit is used for inputting the request message into a code development version under a first running environment to generate a first response message, wherein the first running environment represents a running environment containing noise;
The first acquisition unit is used for acquiring a second response message generated based on the code test version and the request message in a second running environment which is regarded as noiseless;
A pending unit, configured to determine a pending field based on a difference field between the first response packet and the second response packet;
The second obtaining unit is used for obtaining a noise field generated through a difference field between the second response message and a third response message, and the third response message is generated based on the code test version and the request message in the first running environment;
And the removing unit is used for removing noise fields in the undetermined fields to obtain abnormal fields generated by the code development version.
CN202011061448.6A 2020-09-30 2020-09-30 Message testing method and device Active CN114338846B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011061448.6A CN114338846B (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 CN114338846B (en) 2020-09-30 2020-09-30 Message testing method and device

Publications (2)

Publication Number Publication Date
CN114338846A CN114338846A (en) 2022-04-12
CN114338846B true CN114338846B (en) 2024-06-18

Family

ID=81011126

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN114338846B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297041B (en) * 2022-07-29 2024-01-02 深圳前海微众银行股份有限公司 Data verification method and device for flow playback
CN119003381B (en) * 2024-10-24 2025-03-14 宁德时代新能源科技股份有限公司 Automated testing method, device, computer equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109343878A (en) * 2018-09-19 2019-02-15 北京英视睿达科技有限公司 A code deployment method
CN110232022A (en) * 2019-05-21 2019-09-13 深圳壹账通智能科技有限公司 Network environment test method, device and terminal device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8881109B1 (en) * 2009-01-22 2014-11-04 Intuit Inc. Runtime documentation of software testing

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109343878A (en) * 2018-09-19 2019-02-15 北京英视睿达科技有限公司 A code deployment method
CN110232022A (en) * 2019-05-21 2019-09-13 深圳壹账通智能科技有限公司 Network environment test method, device and terminal device

Also Published As

Publication number Publication date
CN114338846A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN111241111B (en) Data query method and device, data comparison method and device, medium and equipment
US11709764B2 (en) Creating test cases for testing software using anonymized log data
CN107092535B (en) Method and apparatus for data storage of test interface
CN109542743B (en) Log checking method and device, electronic equipment and computer readable storage medium
CN111666201A (en) Regression testing method, apparatus, medium and electronic equipment
CN109376534B (en) Method and apparatus for detecting applications
CN116204438A (en) Test case generation method, automatic test method and related device
CN114338846B (en) Message testing method and device
CN112256672B (en) Database change approval method and device
CN112099838A (en) Method, device and storage medium for determining version difference
US9591014B2 (en) Capturing correlations between activity and non-activity attributes using N-grams
CN112131611B (en) Data correctness verification method, device, equipment, system and storage medium
CN113760696B (en) A program problem locating method, device, electronic device and storage medium
CN114218191A (en) System function migration method and device, computer equipment and storage medium
CN113986381A (en) Data analysis method, device, equipment and storage medium
CN119759767A (en) Test case acquisition method, device, equipment, storage medium and program product
CN116483735B (en) Method, device, storage medium and equipment for analyzing influence of code change
CN110162982B (en) Method and device for detecting illegal rights, storage medium and electronic equipment
CN112084114A (en) Method and apparatus for testing an interface
CN110020166B (en) Data analysis method and related equipment
CN113742240B (en) User interface testing method, device, storage medium and electronic device
CN111736848B (en) Packet conflict positioning method, device, electronic equipment and readable storage medium
CN116661758A (en) Method, device, electronic equipment and medium for optimizing log framework configuration
CN115509941A (en) Data interface testing method and device
CN116010244A (en) Automatic test method, device, electronic equipment and storage medium

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