Software testing method, device and storage medium
By automating the comparison of the original execution results with the new execution results, the problem of time-consuming and cumbersome manual data construction in software testing is solved, enabling fast and low-cost software testing.
Patent Information
- Application Number
- CN202210368309.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2042-04-08
AI Technical Summary
In existing technologies, software testing requires manually constructing test data, which is time-consuming and difficult to meet all testing scenarios. Furthermore, the configuration and code modification of traffic replay testing platforms are cumbersome, resulting in a waste of resources and manpower.
By obtaining the log files of the software under test, the traffic replay testing platform automatically compares the original execution results with the new execution results and dynamically compiles data structure transformation rules to achieve rapid testing without modifying the project code.
It enables rapid software testing, reduces development and maintenance costs, avoids waste of resources and manpower, and improves testing efficiency.
Smart Images

Figure CN114880209B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of software testing, and particularly relates to a software testing method, device and storage medium. BACKGROUND
[0002] In scenarios such as interface migration, application splitting, application refactoring and the like that require software testing, a testing method relying on test personnel to manually construct test data is time-consuming, and it is also difficult to construct data that meets all scenario testing, thereby affecting testing effectiveness.
[0003] In the prior art, a method for implementing software testing through a traffic playback testing platform is proposed. However, when a to-be-tested application accesses the traffic playback testing platform, the configuration center may need to be modified. For example, if the traffic playback testing platform needs to perform traffic playback on data of a Dubbo interface, a registration center (for example, a zookeeper) corresponding to the Dubbo interface needs to be configured. Configuring the registration center not only wastes resources, but also is cumbersome to operate. In addition, when the traffic playback testing platform compares the return results of the to-be-tested application, if the data structures of the return results of the new and old versions of the to-be-tested application are different, the project code also needs to be modified and deployed, which also leads to waste of time resources and human resources. In order to solve the above problems, the present disclosure provides a new traffic playback testing platform so as to quickly perform software testing through a real-time traffic playback function. SUMMARY
[0004] In order to quickly perform software testing through a real-time traffic playback function, the present disclosure provides a software testing method, device and storage medium.
[0005] According to an aspect of an embodiment of the present disclosure, a software testing method is provided, and the method comprises:
[0006] obtaining a log file of a to-be-tested software, the log file comprising request parameters and original execution results of traffic data of the to-be-tested software, wherein the traffic data is traffic data in an original version of the to-be-tested software;
[0007] based on the request parameters of the traffic data, obtaining corresponding new execution results, the new execution results being execution results of the traffic data in a to-be-tested version of the to-be-tested software;
[0008] when the data structures of the original execution results and the corresponding new execution results are different, converting the data structure of the to-be-converted results to be consistent with the data structure of the reference results, to obtain to-be-compared execution results;
[0009] comparing the reference results and the to-be-compared execution results to obtain testing results;
[0010] outputting the test result;
[0011] wherein, when the to-be-converted result is the new execution result, the reference result is the original execution result; and when the to-be-converted result is the original execution result, the reference result is the new execution result.
[0012] In an embodiment of the present disclosure, the method further comprises: receiving a data structure conversion rule of the to-be-tested software preconfigured;
[0013] The converting the data structure of the to-be-converted result to be consistent with the data structure of the reference result to obtain the to-be-executed result comprises:
[0014] dynamically compiling the data structure conversion rule to obtain the data structure conversion tool;
[0015] According to the data structure conversion rule, the data structure of the to-be-converted result is converted to obtain the to-be-executed result.
[0016] In another embodiment of the present disclosure, when the reference result and the to-be-executed result are in a Json string format, the comparing the reference result and the to-be-executed result to obtain a test result comprises:
[0017] Converting the reference result and the to-be-executed result into JsonElement elements respectively to obtain a first group of nodes corresponding to the reference result and a second group of nodes corresponding to the to-be-executed result;
[0018] Comparing the first group of nodes and the second group of nodes one by one;
[0019] When the first group of nodes and the second group of nodes are completely consistent, determining that the test result is test passed;
[0020] When the first group of nodes and the second group of nodes are not completely consistent, determining that the test result is test failed, and determining the highest similarity of the first group of nodes and the second group of nodes.
[0021] In another embodiment of the present disclosure, the comparing the first group of nodes and the second group of nodes one by one comprises:
[0022] Determining the node type of at least one node in the first group of nodes and the second group of nodes;
[0023] When the node type of the at least one node is an object or a basic data type or a null type, comparing whether at least one node in the first group of nodes and the second group of nodes is equal, and updating the similarity of the corresponding parent node according to the comparison result, and determining the test result according to the highest parent node similarity;
[0024] when the node type of the at least one node is an array, determining an index number of a child node most similar to an element in the second array compared with an element in the first array and a maximum similarity;
[0025] determining the test result according to the maximum similarity;
[0026] wherein the first array is an array of nodes in the first group of nodes, and the second array is an array of nodes in the second group of nodes corresponding to the first array.
[0027] In yet another embodiment of the present disclosure, when the node type of the at least one node is an object, after the similarity of the parent node is updated according to the comparison result, the method further comprises:
[0028] traversing child nodes of the at least one node using a depth-first traversal algorithm;
[0029] performing the operation of determining the node type of the child node of the at least one node in the first group of nodes and the second group of nodes on the child nodes of the at least one node.
[0030] In yet another embodiment of the present disclosure, when the original execution result and the to-be-compared execution result are in a text format / data stream format, the method of comparing the reference result and the to-be-compared execution result to obtain a test result comprises:
[0031] comparing the reference result and the to-be-compared execution result one by one according to character order;
[0032] when there is an inconsistent character / byte, determining that the test result is a test failure, and outputting the inconsistent character;
[0033] when the characters / bytes of the reference result and the to-be-compared execution result are completely the same, determining that the test result is a test pass.
[0034] In yet another embodiment of the present disclosure, when the to-be-tested software calls Dubbo interface interaction data, the method of obtaining the log file of the to-be-tested software comprises:
[0035] receiving the log file sent by a Dubbo filter component introduced by the to-be-tested software, the Dubbo filter component being a component introduced by the original version of the software.
[0036] In yet another embodiment of the present disclosure, the method of obtaining a corresponding new execution result based on the request parameter of the traffic data comprises:
[0037] obtaining the class name and method name of the Dubbo interface in the log file;
[0038] The domain name information of the Dubbo interface in the to-be-tested version is obtained based on the class name and the method name of the Dubbo interface.
[0039] The hypertext transfer protocol request message is sent to the to-be-tested version based on the domain name information, the class name, and the method name of the Dubbo interface.
[0040] The new execution result returned by an http2 Dubbo component in the to-be-tested version according to the hypertext transfer protocol request message is received, the http2 Dubbo component is a component introduced in the to-be-tested version, and the http2 Dubbo component is configured to analyze information of a Dubbo interface and call the Dubbo interface.
[0041] According to a further aspect of the embodiments of the present disclosure, a software testing device is provided, and the device comprises:
[0042] The first obtaining module is configured to obtain a log file of a to-be-tested software, the log file comprising request parameters and original execution results of traffic data of the to-be-tested software, wherein the traffic data is traffic data in an original version of the to-be-tested software.
[0043] The second obtaining module is configured to obtain corresponding new execution results based on the request parameters of the traffic data, the new execution results being execution results of the traffic data in a to-be-tested version of the to-be-tested software.
[0044] The data structure conversion module is configured to convert a data structure of a to-be-converted result to be consistent with a data structure of a reference result when the data structures of the original execution results and the corresponding new execution results are different, to obtain a to-be-compared execution result.
[0045] The comparison module is configured to compare the reference result and the to-be-compared execution result to obtain a testing result.
[0046] The output module is configured to output the testing result.
[0047] When the to-be-converted result is the new execution result, the reference result is the original execution result; and when the to-be-converted result is the original execution result, the reference result is the new execution result.
[0048] In an embodiment of the present disclosure, the device further comprises a first receiving module configured to receive a data structure conversion rule pre-configured by the to-be-tested software.
[0049] The data structure conversion module comprises:
[0050] The compiling submodule is configured to dynamically compile the data structure conversion rule to obtain the data structure conversion tool.
[0051] a conversion submodule, configured to convert a data structure of the to-be-converted result according to a conversion rule of the data structure, to obtain the to-be-executed result.
[0052] In another embodiment of the present disclosure, when the reference result and the to-be-executed result are in a Json string format, the comparison module comprises:
[0053] a first conversion submodule, configured to convert the reference result and the to-be-executed result into JsonElement elements respectively, to obtain a first group of nodes corresponding to the reference result and a second group of nodes corresponding to the to-be-executed result;
[0054] a first comparison submodule, configured to compare the first group of nodes and the second group of nodes one by one;
[0055] a first determination submodule, configured to determine that a test result is test passed when the first group of nodes and the second group of nodes are completely consistent;
[0056] a second determination submodule, configured to determine that the test result is test failed when the first group of nodes and the second group of nodes are not completely consistent, and determine a highest similarity of the first group of nodes and the second group of nodes.
[0057] In another embodiment of the present disclosure, the first comparison submodule comprises:
[0058] a third determination submodule, configured to determine a node type of at least one node in the first group of nodes and the second group of nodes;
[0059] a second comparison submodule, configured to compare whether at least one node in the first group of nodes and the second group of nodes is equal when the node type of the at least one node is an object or a basic data type or a null type, and update a similarity of a corresponding parent node according to a comparison result, and determine the test result according to a highest parent node similarity;
[0060] a fourth determination submodule, configured to determine an index number and a maximum similarity of a most similar sub-node in a second array of elements compared with a first array of elements when the node type of the at least one node is an array;
[0061] a fifth determination submodule, configured to determine the test result according to the maximum similarity, wherein the first array is an array of nodes in the first group of nodes, and the second array is an array of nodes corresponding to the first array in the second group of nodes.
[0062] In another embodiment of the present disclosure, when the node type of the at least one node is an object, the apparatus further comprises:
[0063] a depth traversal module, configured to traverse child nodes of the at least one node using a depth traversal algorithm;
[0064] a node type determination module, configured to perform the operation of determining the node type of the child node of at least one node in the first group of nodes and the second group of nodes on the child node of the at least one node.
[0065] In yet another embodiment of the present disclosure, when the reference result and the to-be-compared execution result are in a text format / data stream format, the comparison module comprises:
[0066] a third comparison sub-module, configured to compare the reference result and the to-be-compared execution result one by one in character order;
[0067] a first determination sub-module, configured to determine that the test result is a test failure when there is an inconsistent character / byte, and output the inconsistent character;
[0068] a second determination sub-module, configured to determine that the test result is a test pass when the reference result and the to-be-compared execution result are completely identical.
[0069] In yet another embodiment of the present disclosure, when the to-be-tested software calls Dubbo interface interaction data, the first acquisition module is specifically configured to receive the log file sent by a Dubbo filter component introduced by the to-be-tested software, the Dubbo filter component being a component introduced by the original version software.
[0070] In yet another embodiment of the present disclosure, the second acquisition module comprises:
[0071] a first acquisition sub-module, configured to acquire the class name and the device name of the Dubbo interface in the log file;
[0072] a second acquisition sub-module, configured to acquire domain name information of the Dubbo interface in the to-be-tested version based on the class name and the device name of the Dubbo interface;
[0073] a sending sub-module, configured to send a hypertext transfer protocol request message to the to-be-tested version based on the domain name information, the class name, and the device name of the Dubbo interface;
[0074] a receiving sub-module, configured to receive a new execution result returned by an http2 Dubbo component in the to-be-tested version according to the hypertext transfer protocol request message, the http2 Dubbo component being a component introduced by the to-be-tested version, and the http2 Dubbo component being configured to parse information of a Dubbo interface and call the Dubbo interface.
[0075] According to still another aspect of the embodiments of the present disclosure, an electronic device is provided, which comprises:
[0076] a memory for storing a computer program;
[0077] a processor for executing the computer program stored in the memory, and when the computer program is executed, the software testing method described above is implemented.
[0078] According to still another aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the software testing method described above is implemented.
[0079] According to still another aspect of the embodiments of the present disclosure, a computer program product is provided, which comprises computer program / instructions, and when the computer program / instructions are executed by a processor, the software testing method described above is implemented.
[0080] Based on the software testing method, device and storage medium provided by the embodiments of the present disclosure, the traffic data and the original execution result in the original version of the software are obtained through the traffic playback test platform, then the corresponding new execution result is obtained according to the traffic data in the original version of the software, and the original execution result and the new execution result are compared, so that the test result of the software is obtained. Through the traffic playback test platform, the software testing can be quickly performed through the real-time traffic playback function, and when the data structures of the original execution result and the new execution result are different, the data structure conversion tool obtained through dynamic compilation is used to convert the execution results with consistent data structures, so that the developers do not need to modify the project code, and the traffic playback test platform does not need to be re-uploaded, thereby reducing the development cost and maintenance cost of the traffic playback test platform.
[0081] The technical solutions of the present disclosure will be described in further detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0082] The accompanying drawings, which form a part of the specification, illustrate embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0083] The present disclosure can be more clearly understood with reference to the following detailed description when considered in conjunction with the accompanying drawings, in which:
[0084] Figure 1 a flowchart of an embodiment of the software testing method of the present disclosure;
[0085] Figure 2A a flowchart of the comparison of the original execution result and the to-be-compared execution result of the software testing method of the present disclosure;
[0086] Figure 2BA schematic diagram of converting a Json string into a JsonElement element for the software testing method of the present disclosure;
[0087] Figure 2C A schematic diagram of displaying a test result for the software testing method of the present disclosure;
[0088] Figure 2D A flowchart of comparing two groups of nodes one by one for the software testing method of the present disclosure;
[0089] Figure 3 A flowchart of playing back traffic data when a software under test calls a Dubbo interface for the software testing method of the present disclosure;
[0090] Figure 4 A structural schematic diagram of one embodiment of the software testing apparatus of the present disclosure;
[0091] Figure 5 A structural schematic diagram of another embodiment of the software testing apparatus of the present disclosure;
[0092] Figure 6 A structural schematic diagram of another embodiment of the software testing apparatus of the present disclosure;
[0093] Figure 7 A structural diagram of an electronic device provided by an illustrative embodiment of the present disclosure. DETAILED DESCRIPTION
[0094] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the present disclosure unless otherwise specifically stated.
[0095] It should be understood that the sizes of the various portions shown in the drawings are not necessarily drawn to scale for ease of description.
[0096] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way limiting to the scope of the disclosure and its applications or uses.
[0097] Techniques, methods, and devices known to those of ordinary skill in the relevant art can not be discussed in detail herein. However, where appropriate, such techniques, methods, and devices can be considered part of the specification.
[0098] It should be noted that like reference numerals and letters refer to like items in the drawings, and thus, once an item is defined in one drawing, it need not be discussed further in subsequent drawings.
[0099] The embodiments of the present disclosure can be applied to computer systems / servers and other electronic devices, which can operate with many other general-purpose or special-purpose computing system environments or configurations. Examples of well-known computing systems, environments, and / or configurations suitable for use with computer systems / servers and other electronic devices include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, minicomputer systems, mainframe computer systems, and distributed cloud computing technology environments comprising any of the above systems, and the like.
[0100] The computer systems / servers and other electronic devices can be described in the general context of computer system-executable instructions, such as program modules, being executed by the computer system. Generally, program modules can include routines, programs, objects, components, logic, data structures, and the like, which perform particular tasks or implement particular abstract data types. The computer systems / servers can be implemented in a distributed cloud computing environment, in which tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules can be located in local or remote computer system storage media including storage devices.
[0101] SUMMARY
[0102] The technical solutions provided by the embodiments of the present disclosure are applied in the software testing scene, in the scene of interface migration, application program splitting, application program reconstruction, and the like, which need software testing. In order to avoid the huge time consumption and incomplete data problems caused by manually constructing full-scene test data, the traffic playback testing platform can be used, so as to realize automatic testing of full-scene. In addition, the traffic playback testing platform provided by the embodiments of the present disclosure also solves the problems of low-cost access to Dubbo interface traffic data, different data structures of the execution results of the original version software and the execution results of the to-be-tested version, and the de-duplication processing of elements in the array that have been compared and judged as equal when the traffic playback testing platform executes the comparison between the execution results of the original version software and the execution results of the to-be-tested version, and the like, which meets the playback demand of test traffic and solves the problem of huge repetitive testing work in daily interface verification.
[0103] EXEMPLARY EMBODIMENTS
[0104] Figure 1 The flowchart of one embodiment of the software testing method of the present disclosure; the software testing method can be applied to a traffic playback testing platform (such as a computer system, a server), as shown in FIG. 1, the software testing method comprises the following steps: Figure 1
[0105] In step 101, a log file of the to-be-tested software is acquired, and the log file includes a request parameter and an original execution result of traffic data of the to-be-tested software.
[0106] In an embodiment, the traffic data is traffic data in an original version of the to-be-tested software.
[0107] In an embodiment, generally, when the to-be-tested software accesses a traffic playback test platform, the traffic playback test platform provides a software development kit (SDK) component for the to-be-tested software, and after the original version of the to-be-tested software introduces the SDK component, a log file can be printed after the original version of the to-be-tested software receives a traffic request sent by the traffic playback test platform each time. The log file can include a request parameter and an original execution result of traffic data and the like.
[0108] In an embodiment, it needs to be noted that, in order to solve the traffic playback of a Dubbo interface, the traffic playback test platform can add a set of Dubbo general access components to the SDK component provided for the to-be-tested software, and the Dubbo general access components include a Dubbo filter component and an http2Dubbo component. Specifically, the Dubbo filter component can be introduced into the original version of the to-be-tested software, and the http2Dubbo component can be introduced into the to-be-tested version. Thus, after the original version of the to-be-tested software receives a traffic request, the original version of the to-be-tested software can acquire traffic data (including a request parameter and an original execution result) through the introduced Dubbo filter component, and then send the request parameter and the original execution result of the traffic data to the traffic playback test platform.
[0109] After the to-be-tested software that calls a Dubbo interface introduces the SDK component provided by the traffic playback test platform and including the Dubbo general access components, the traffic playback test platform does not need to configure a registry center for the Dubbo interface in its own configuration center, thereby avoiding resource waste.
[0110] In step 102, a new execution result corresponding to the request parameter of the traffic data is acquired.
[0111] In an embodiment, the new execution result is an execution result of the traffic data in a to-be-tested version of the to-be-tested software.
[0112] In an embodiment, after the traffic playback test platform acquires a request parameter and an original execution result from a log file, the traffic playback test platform can find a domain name, a uniform resource locator (URL) and the like of an interface of a to-be-tested version of the to-be-tested software in a configuration center, and then use the request parameter acquired from the log file to call the interface of the to-be-tested version, so as to acquire a new execution result.
[0113] In an embodiment, after the traffic playback test platform obtains the log file of the traffic data of the software under test which calls the Dubbo interface, the domain name, class name and other information of the Dubbo interface of the version under test can be obtained from the configuration center according to the Dubbo interface class name and method name in the log file, and then wrapped into a Hyper Text Transfer Protocol (HTTP) request to send an HTTP request to the version under test. After the http2Dubbo component of the version under test receives the HTTP request, the information of the Dubbo interface can be parsed, the Dubbo interface is called by reflection, and then the new execution result is returned to the traffic playback test platform.
[0114] In step 103, when the data structure of the original execution result and the corresponding new execution result are different, the data structure of the result to be converted is converted to be consistent with the data structure of the reference result, to obtain the result to be compared.
[0115] In an embodiment, when the result to be converted is the new execution result, the reference result is the original execution result, that is, the data structure of the new execution result can be converted to be consistent with the data structure of the original execution result. In an embodiment, when the result to be converted is the original execution result, the reference result is the new execution result, that is, the data structure of the original execution result can be converted to be consistent with the data structure of the new execution result.
[0116] In an embodiment, in order to implement the technical scheme of the embodiment of the present disclosure, the traffic playback test platform can receive the data structure conversion rule pre-configured by the software under test. Specifically, the conversion of the data structure of the result to be converted to be consistent with the data structure of the reference result to obtain the result to be compared includes: dynamically compiling the data structure conversion rule to obtain the data structure conversion tool; and converting the data structure of the result to be converted according to the data structure conversion rule to obtain the result to be compared.
[0117] In a specific implementation, after the business development personnel or the test personnel of the software under test pre-configure the data structure conversion rule, the data structure conversion rule can be sent to the traffic playback test platform when accessing the traffic playback test platform for testing, so that the traffic playback test platform can automatically produce code by dynamically compiling the data structure conversion rule when the data structure needs to be converted, and the data structure conversion tool is obtained by being dynamically compiled into the traffic playback test platform. Therefore, the developers of the traffic playback test platform do not need to modify the code and redeploy the project again, and the human cost of communication and deployment of the project is saved.
[0118] In an embodiment, when the original execution result and the new execution result are processed, string fields that do not need to be compared, such as timestamp information, can also be filtered out at the same time. The timestamp information is not the same in the original execution result and the corresponding new execution result, and the timestamp information is not related to the software test. Therefore, these string fields that do not need to be compared can be directly filtered out.
[0119] In step 104, the reference result and the to-be-compared execution result are compared to obtain a test result.
[0120] In an embodiment, the data types of the reference result and the to-be-compared execution result can be in a Json string format, a text format, or a data stream format. Different comparison algorithms can be used for different data types.
[0121] In an embodiment, when the reference result and the to-be-compared execution result are in a text format or a data stream format, the specific steps of comparing the reference result and the to-be-compared execution result to obtain a test result are as follows: the reference result and the to-be-compared execution result are compared one by one according to the character order; when there is an inconsistent character / byte, it is determined that the test result is a test failure, and the inconsistent character is output; when the characters / bytes of the reference result and the to-be-compared execution result are completely the same, it is determined that the test result is a test success.
[0122] After comparing the reference result and the to-be-compared execution result, the inconsistent character / byte can also be recorded and output for the reference of the tester.
[0123] In an embodiment, when the data types of the reference result and the to-be-compared execution result are in a Json string format, the reference result and the to-be-compared execution result can be compared by referring to the embodiment shown in Figure 2A The details are not described here.
[0124] In step 105, the test result is output.
[0125] In an embodiment, when the test result is a test success, a prompt information of a test success can be directly output. When the test result is a test failure, in addition to outputting a prompt information of a test failure, the similarity of the original execution result and the to-be-compared execution result, and the byte / character that causes the test result to fail can also be further output.
[0126] The steps 101-105 described above obtain the traffic data in the original version of the software through the traffic playback test platform, and then obtain the corresponding new execution result according to the traffic data in the original version of the software. The test result of the software can be obtained by comparing the original execution result and the new execution result. The technical scheme of the present disclosure can quickly perform software testing through the real-time traffic playback function, and when the data structures of the original execution result and the new execution result are different, the data structure conversion tool obtained through dynamic compilation can be used to convert the execution result into a data structure consistent with the data structure, without the need for the developer to modify the project code, and thus without the need to re-online the traffic playback test platform, thereby reducing the development cost and maintenance cost of the traffic playback test platform.
[0127] In order to better illustrate the software testing scheme of the present disclosure, another embodiment will be described below.
[0128] Figure 2A A flowchart for comparing the original execution result and the to-be-compared execution result of the software testing method of the present disclosure is shown in Figure 2B A schematic diagram of converting a Json string into a JsonElement element of the software testing method of the present disclosure is shown in Figure 2C A schematic diagram of displaying the test result of the software testing method of the present disclosure is shown in Figure 2D A flowchart for comparing two groups of nodes one by one of the software testing method of the present disclosure is shown in the present embodiment, which is exemplarily illustrated by comparing the original execution result and the to-be-compared execution result in the Json string format, as shown in Figure 2A The steps include the following steps:
[0129] In step 201, the reference result and the to-be-compared execution result are respectively converted into JsonElement elements, to obtain a first group of nodes corresponding to the reference result and a second group of nodes corresponding to the to-be-compared execution result.
[0130] In an embodiment, the Diff algorithm can be used to compare the Json strings. In a specific implementation, the original execution result and the to-be-compared execution result can be first converted into JsonElement elements, to obtain a first group of nodes corresponding to the original execution result and a second group of nodes corresponding to the to-be-compared execution result. For example, the two Json strings to be compared are as follows:
[0131]
[0132]
[0133] The Json string 1 and the Json string 2 can be respectively converted into JsonElement elements, as shown in Figure 2BFig. 1 is a schematic diagram of converting a Json string 1 into a JsonElement element. The JsonElement element converted from the Json string includes a set of nodes.
[0134] In step 202, the first set of nodes and the second set of nodes are compared one by one.
[0135] In an embodiment, a depth-first traversal algorithm can be used to traverse the first set of nodes and the second set of nodes, and compare the two sets of nodes one by one to determine whether they are completely equal. The node type of each node can be different, and the node type can be a basic data type, a null type, an array, an object, etc. Different comparison methods can be used for different node types. Specifically, the two sets of nodes can be compared according to the embodiment shown in Fig. 2, including steps 211-214. Figure 2D
[0136] In step 211, the node type of at least one node in the first set of nodes and the second set of nodes is determined.
[0137] In an embodiment, the first set of nodes and the second set of nodes are respectively converted from the original execution result and the to-be-compared execution result.
[0138] In step 212, when the node type of the at least one node is an object or a basic data type or a null type, it is determined whether the at least one node in the first set of nodes and the second set of nodes is equal, and the similarity of the corresponding parent node is updated according to the comparison result, and the test result is determined according to the similarity of the highest parent node.
[0139] In an embodiment, the highest parent node can be understood as the root node.
[0140] In an embodiment, when the node type is an object or a basic data type or a null type, it can be directly determined whether the two nodes are equal, and the similarity of the parent node is updated according to the comparison result. For example, if the two nodes are equal, the similarity of the corresponding parent node can be updated. For example, if the first set of nodes and the second set of nodes are equal, the similarity of the corresponding parent node can be updated.
[0141] In an embodiment, after the similarity of the parent node is updated according to the comparison result when the node type is an object, the operation of using a depth traversal algorithm to traverse the child nodes of the at least one node, and performing the operation of determining the node type of the child nodes of the at least one node in the first set of nodes and the second set of nodes can be performed. That is, when the node type of the at least one node is an object, in addition to comparing the node type of the at least one node, it is also necessary to traverse and compare whether the corresponding child nodes are equal.
[0142] In step 213, when the node type of the at least one node is an array, the index number of the most similar sub-node and the maximum similarity of the element in the second array compared with the element in the first array are determined.
[0143] In an embodiment, the first array is an array of nodes in the first group of nodes, and the second array is an array of nodes in the second group of nodes corresponding to the first array.
[0144] Since the array contains at least one element, when the node type is an array, a many-to-many comparison needs to be performed on multiple elements in the array. If the results are different, there are multiple possibilities. Therefore, when comparing nodes of the array type, a similarity comparison algorithm can be used to find the most similar one for each array in the array as the test result. As shown in the following table, when comparing elements in two arrays, a pair of elements with the highest similarity (the more internal fields are equal, the higher the similarity) can be selected as the test result to be displayed. The result obtained in this way is also the most accurate, Figure 2C Figure 2C In the table, a pair of elements with a similarity of 67% can be used as the test result to be displayed, and a pair of elements with a similarity of 0% is not displayed.
[0145] In step 214, the test result is determined according to the maximum similarity.
[0146] In step 203, when the first group of nodes and the second group of nodes are completely consistent, the test result is determined to be test passed.
[0147] In an embodiment, when the first group of nodes corresponding to the original execution result and the second group of nodes corresponding to the to-be-compared execution result are completely consistent, the test result can be determined to be test passed.
[0148] In step 204, when the first group of nodes and the second group of nodes are not completely consistent, the test result is determined to be test failed, and the maximum similarity of the first group of nodes and the second group of nodes is determined.
[0149] In an embodiment, after the current element in the first array is compared with the element in the second array, if they are not equal, the information of the most similar element in the second array compared with the current element in the first array can be retained, and the most similar element retained is selected as the test result to be displayed.
[0150] The steps 201-204 described above realize deep comparison of two Json strings through the flow playback test platform, and when the two node types to be compared are arrays, the information of the element most similar to a current element in the array is reserved, so that when two elements that are completely equal cannot be found in the two arrays, the two most similar elements are found to display the test result.
[0151] Figure 3 A flowchart for flow data playback of a Dubbo interface called by the software to be tested of the software testing method of the present disclosure; this embodiment takes how to realize flow data playback of a Dubbo interface as an example for illustrative description, as shown in Figure 3 , including the following steps:
[0152] In step 301, the class name and method name of the Dubbo interface in the log file are obtained.
[0153] In an embodiment, in order to realize the embodiment of the present disclosure, a Dubbo general access component needs to be introduced into the software to be tested that calls a Dubbo interface to interact with data, specifically a Dubbo filter component is introduced into the original version of the software to be tested, and an http2Dubbo component is introduced into the version to be tested.
[0154] In an embodiment, the original version of the software to be tested can obtain flow data (including request parameters and original execution results) from the introduced Dubbo filter component after receiving a flow request, and then send the flow data to the flow playback test platform.
[0155] In step 302, the domain name information of the Dubbo interface in the version to be tested is obtained based on the class name and method name of the Dubbo interface.
[0156] In step 303, a hypertext transfer protocol request message is sent to the version to be tested based on the domain name information, class name, and method name of the Dubbo interface.
[0157] In step 304, a new execution result returned by an http2Dubbo component in the version to be tested according to the hypertext transfer protocol request message is received, the http2Dubbo component is a component introduced into the version to be tested, and the http2Dubbo component is used to analyze information of a Dubbo interface and call the Dubbo interface.
[0158] In steps 301-304, after the traffic playback test platform obtains the log file of the traffic data of the software to be tested calling the Dubbo interface, the traffic playback test platform can obtain the domain name, class name and other information of the Dubbo interface of the to-be-tested version from the configuration center according to the class name and method name of the Dubbo interface in the log file, and then wrap the information into an HTTP request and send the HTTP request to the to-be-tested version. After the http2Dubbo component of the to-be-tested version receives the HTTP request, the information of the Dubbo interface can be parsed, the Dubbo interface can be called by reflection, and then the http2Dubbo component in the to-be-tested version returns the new execution result to the traffic playback test platform.
[0159] The steps 301-304 above, by providing the Dubbo filter component and the http2Dubbo component for the software to be tested calling the Dubbo interface through the traffic playback test platform, the new execution result of the Dubbo interface of the to-be-tested version can be called through the HTTP request after receiving the traffic data sent by the original version software through the Dubbo filter component, and the comparison of the execution results of the two Dubbo interfaces can be realized. The SDK component provided by the traffic playback test platform including the Dubbo general access component is introduced into the software to be tested calling the Dubbo interface, the traffic data provided by the software to be tested can be quickly obtained, and the resource waste can be avoided by not configuring the registry center for the Dubbo interface in the configuration center of the software to be tested.
[0160] Corresponding to the foregoing embodiments of the software testing method, the present disclosure also provides corresponding embodiments of the software testing device.
[0161] Figure 4 The structure diagram of one embodiment of the software testing device of the present disclosure is shown in the figure. The device is applied to an electronic device (such as a computer system, a server), and the device includes: Figure 4
[0162] The first obtaining module 41 is configured to obtain a log file of the software to be tested, and the log file includes request parameters and original execution results of traffic data of the software to be tested, wherein the traffic data is traffic data in the original version software of the software to be tested;
[0163] The second obtaining module 42 is configured to obtain a corresponding new execution result based on the request parameters of the traffic data, and the new execution result is an execution result of the traffic data in the to-be-tested version of the software to be tested;
[0164] The data structure conversion module 43 is used to convert the data structure of the result to be converted to be consistent with the data structure of the reference result when the data structures of the original execution result and the corresponding new execution result are different, so as to obtain the execution result to be converted. When the result to be converted is the new execution result, the reference result is the original execution result; when the result to be converted is the original execution result, the reference result is the new execution result.
[0165] Comparison module 44 is used to compare the reference result and the result to be executed to obtain the test result;
[0166] Output module 45 is used to output test results.
[0167] Figure 5 This is a schematic diagram of another embodiment of the software testing apparatus disclosed herein, as shown below. Figure 5 As shown, in Figure 4 Based on the illustrated embodiments, in one embodiment, the apparatus further includes:
[0168] The first receiving module 46 is used to receive the data structure conversion rules pre-configured by the software under test;
[0169] Data structure conversion module 43 includes:
[0170] Compilation submodule 431 is used to dynamically compile data structure conversion rules to obtain a data structure conversion tool;
[0171] The conversion submodule 432 is used to convert the data structure of the result to be converted according to the data structure conversion rules, so as to obtain the result to be executed.
[0172] In one embodiment, when both the reference result and the result to be compared are in JSON string format, the comparison module 44 includes:
[0173] The first conversion submodule 441 is used to convert the reference result and the result to be executed into JsonElement elements respectively, so as to obtain the first group of nodes corresponding to the reference result and the second group of nodes corresponding to the result to be executed.
[0174] The first comparison submodule 442 is used to compare the first group of nodes and the second group of nodes one by one.
[0175] The first determining submodule 443 is used to determine the test result as passed when the first group of nodes and the second group of nodes are completely consistent.
[0176] The second determining submodule 444 is used to determine the test result as a failure when the first group of nodes and the second group of nodes are not completely consistent, and to determine the highest similarity between the first group of nodes and the second group of nodes.
[0177] In one embodiment, the first comparison submodule 442 includes:
[0178] The third determining sub-module 4421 is configured to determine the node type of at least one node in the first group of nodes and the second group of nodes.
[0179] The second comparing sub-module 4422 is configured to compare whether at least one node in the first group of nodes and the second group of nodes is equal when the node type of the at least one node is an object or a basic data type or a null type, and update the similarity of the corresponding parent node according to a comparison result, and determine a test result according to the similarity of the highest parent node.
[0180] The fourth determining sub-module 4423 is configured to determine the index number and the maximum similarity of the most similar sub-node of the element in the second array compared with the element in the first array when the node type of the at least one node is an array.
[0181] The fifth determining sub-module 4424 is configured to determine the test result according to the maximum similarity, wherein the first array is a node array in the first group of nodes, and the second array is a node array corresponding to the first array in the second group of nodes.
[0182] In an embodiment, when the node type of the at least one node is an object, the device further comprises:
[0183] The depth traversal module 47 is configured to traverse the child nodes of the at least one node using a depth traversal algorithm.
[0184] The node type determining module 48 is configured to perform the operation of determining the node type of the child nodes of the at least one node in the first group of nodes and the second group of nodes.
[0185] Figure 6 The structural schematic diagram of still another embodiment of the software testing device of the present disclosure is shown in Figure 6 , which is based on the embodiments shown in Figure 4 and / or Figure 5 In an embodiment, when the reference result and the to-be-compared execution result are in a text format / data stream format, the comparing module 44 comprises:
[0186] The third comparing sub-module 445 is configured to compare the reference result and the to-be-compared execution result one by one according to the character order.
[0187] The first determining sub-module 446 is configured to determine that the test result is a test failure when there is an inconsistent character / byte, and output the inconsistent character.
[0188] The second determining sub-module 447 is configured to determine that the test result is a test pass when the characters / bytes of the reference result and the to-be-compared execution result are completely identical.
[0189] In an embodiment, when the to-be-tested software calls Dubbo interface interaction data, the first acquisition module 41 is specifically configured to receive a log file sent by a Dubbo filter component introduced by the to-be-tested software, and the Dubbo filter component is a component introduced by the original version software.
[0190] In an embodiment, the second acquisition module 42 includes:
[0191] The first acquisition sub-module 421 is configured to acquire the class name and the device name of the Dubbo interface in the log file.
[0192] The second acquisition sub-module 422 is configured to acquire domain name information of the Dubbo interface in the to-be-tested version based on the class name and the device name of the Dubbo interface.
[0193] The sending sub-module 423 is configured to send a hypertext transfer protocol request message to the to-be-tested version based on the domain name information, the class name, and the device name of the Dubbo interface.
[0194] The receiving sub-module 424 is configured to receive a new execution result returned by an http2Dubbo component in the to-be-tested version according to the hypertext transfer protocol request message, the http2Dubbo component being a component introduced by the to-be-tested version, and the http2Dubbo component being configured to parse information of the Dubbo interface and call the Dubbo interface.
[0195] For the implementation process of the functions and roles of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method, which will not be repeated here.
[0196] For the device embodiment, since it basically corresponds to the method embodiment, please refer to the part of the method embodiment. The device embodiment described above is only illustrative, and the units described as separate components can be or can not be physically separated, and the components shown as units can be or can not be physical units, that is, they can be located in one place or distributed on multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the present disclosure. Those skilled in the art can understand and implement it without creative labor.
[0197] Next, the electronic device according to the embodiment of the present disclosure will be described with reference to Figure 7 The electronic device according to the embodiment of the present disclosure can implement the device of the method of the present disclosure. Figure 7 The structural diagram of the electronic device provided by the illustrative embodiment of the present disclosure is shown in Figure 7As shown, the electronic device 7 includes one or more processors 71, a memory 72 of one or more computer readable storage media, and a computer program stored on the memory and executable on the processor. When the program of the memory 72 is executed, the above-mentioned software testing method can be implemented.
[0198] In particular, in practical applications, the electronic device can further include input devices 73, output devices 74, and the like, and these components are interconnected through a bus system and / or other forms of connection mechanism (not shown). Those skilled in the art can understand that, Figure 7 The structure of the electronic device shown in the figure does not constitute a limitation on the electronic device, and can include more or fewer components than shown, or certain components, or different arrangement of components. Among them:
[0199] The processor 71 can be a central processing unit (CPU) or other forms of processing unit having data processing capability and / or instruction execution capability, and can control other components in the electronic device to perform desired functions.
[0200] The memory 72 can store one or more computer program products, and the memory can include various forms of computer readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may, for example, include random access memory (RAM) and / or cache memory, etc. Non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc. One or more computer program products can be stored on the computer readable storage medium, and the processor 71 can run the computer program product to implement the software testing method of various embodiments of the present disclosure above and / or other desired functions.
[0201] In one example, the electronic device can further include input devices 73 and output devices 74, and these components are interconnected through a bus system and / or other forms of connection mechanism (not shown),
[0202] In addition, the input device 73 can include, for example, a keyboard, a mouse, and the like.
[0203] The output device 74 can output various information to the outside, including the determined distance information, direction information, and the like. The output device 74 can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, and the like.
[0204] Of course, in order to simplify, Figure 7 In the figure, only some of the components related to the present disclosure in the electronic device 7 are shown, and components such as buses, input / output interfaces, and the like are omitted. In addition, according to specific application circumstances, the electronic device 7 can also include any other appropriate components.
[0205] In addition to the methods and apparatus described above, embodiments of the present disclosure can also be a computer program product including computer program instructions that, when executed by a processor, cause the processor to perform steps of the software testing method according to various embodiments of the present disclosure described in the above “Exemplary Method” section of the specification.
[0206] The computer program product can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++, etc., and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server.
[0207] In addition, embodiments of the present disclosure can also be a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, cause the processor to perform steps of the software testing method according to various embodiments of the present disclosure described in the above “Exemplary Method” section of the specification.
[0208] The computer readable storage medium can be any combination of one or more non-transitory media. The non-transitory medium can be a non-transitory signal medium or a non-transitory storage medium. The non-transitory storage medium can include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the non-transitory storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or 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 above.
[0209] The above describes the basic principles of the present disclosure in combination with specific embodiments, but it should be noted that the advantages, benefits, effects, etc. mentioned in the present disclosure are only examples and are not limiting, and these advantages, benefits, effects, etc. cannot be considered as the must-have of each embodiment of the present disclosure. In addition, the above specific details are only for the purpose of example and understanding, and are not limiting, and the above details do not limit the present disclosure to the must-have of the above specific details.
[0210] The various embodiments described in this specification are intended to be exemplary and illustrative, and not exhaustive or limiting. Numerous modifications and variations are possible in light of the above teachings. For example, the described embodiments can be implemented in other ways than those specifically described. The described embodiments can be implemented in software, hardware, firmware, or any combination thereof. The order of the steps described in the embodiments can be changed. The various embodiments described in this specification are intended to be exemplary and illustrative, and not exhaustive or limiting. Numerous modifications and variations are possible in light of the above teachings. For example, the described embodiments can be implemented in other ways than those specifically described. The described embodiments can be implemented in software, hardware, firmware, or any combination thereof. The order of the steps described in the embodiments can be changed. The various embodiments described in this specification are intended to be exemplary and illustrative, and not exhaustive or limiting. Numerous modifications and variations are possible in light of the above teachings. For example, the described embodiments can be implemented in other ways than those specifically described. The described embodiments can be implemented in software, hardware, firmware, or any combination thereof. The order of the steps described in the embodiments can be changed. The various embodiments described in this specification are intended to be exemplary and illustrative, and not exhaustive or limiting. Numerous modifications and variations are possible in light of the above teachings. For example, the described embodiments can be implemented in other ways than those specifically described. The described embodiments can be implemented in software, hardware, firmware, or any combination thereof. The order of the steps described in the embodiments can be changed.
[0211] Those of ordinary skill in the art will appreciate that the hardware used to implement the various illustrative logics described herein can be implemented with a general purpose computer or computer processor. Those of ordinary skill in the art will appreciate that the various logics described herein can be implemented with software instructions executed by a computer processor. Those of ordinary skill in the art will appreciate that the various illustrative logics described herein can be implemented with a hardware logic circuit such as a discrete component or an integrated circuit that executes software instructions. Those of ordinary skill in the art will appreciate that any combination of hardware logic circuits and software instructions can be used to implement the various illustrative logics described herein.
[0212] The methods and apparatus of this disclosure can be implemented in any of numerous ways. For example, the methods and apparatus can be implemented using software, hardware, firmware, or any combination of software, hardware, and firmware. The order of any steps described in the methods can be changed, unless otherwise specifically stated or otherwise obvious from the specification. Also, some steps can be optional, unless otherwise specifically stated or obvious from the specification. Furthermore, some steps can be performed in parallel, unless otherwise specifically stated or obvious from the specification. Moreover, the specification and drawings are not to be considered limitations on the scope of the disclosure. Accordingly, the disclosure is to be understood not to be limited to the specific illustrative implementations described and / or illustrated.
[0213] The description in this specification has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the disclosure to the precise forms described. Many modifications and variations will be possible in light of the above teachings. The described embodiments were chosen in order to best illustrate the principles of the disclosure and its practical application. It is intended that the scope of the disclosure be defined by the claims appended hereto, and their equivalents.
Claims
1. A software testing method characterized by, The method is applied to a traffic playback test platform, the traffic playback test platform introduces a Dubbo filter component in a original version software of a to-be-tested software, and introduces an http2 Dubbo component in a to-be-tested version of the to-be-tested software, and the method comprises the following steps: obtaining a log file of the to-be-tested software, the log file comprising request parameters and original execution results of traffic data of the to-be-tested software, wherein the traffic data is traffic data in the original version software of the to-be-tested software, and the traffic data is obtained through the Dubbo filter component introduced in the original version software; based on the request parameters of the traffic data, obtaining corresponding new execution results, the new execution results being execution results of the traffic data in the to-be-tested version of the to-be-tested software, the new execution results being results returned by the http2 Dubbo component in the to-be-tested version, the http2 Dubbo component being used for parsing information of a Dubbo interface and calling the Dubbo interface; when the data structures of the original execution results and the corresponding new execution results are different, converting a data structure of a to-be-converted result to be consistent with a data structure of a reference result, to obtain a to-be-compared execution result; comparing the reference result and the to-be-compared execution result to obtain a test result; outputting the test result; wherein, when the to-be-converted result is the new execution result, the reference result is the original execution result; when the to-be-converted result is the original execution result, the reference result is the new execution result; the method further comprises: receiving a data structure conversion rule pre-configured by the to-be-tested software; the method further comprises: receiving a data structure conversion rule pre-configured by the to-be-tested software; the method further comprises: receiving a data structure conversion rule pre-configured by the to-be-tested software; the method further comprises: receiving a data structure conversion rule pre-configured by the to-be-tested software; 2. The method of claim 1, wherein, the method further comprises: receiving a data structure conversion rule pre-configured by the to-be-tested software. when the reference result and the to-be-compared execution result are in a Json string format, the comparing the reference result and the to-be-compared execution result to obtain a test result comprises: converting the reference result and the to-be-compared execution result into JsonElement elements respectively, to obtain a first group of nodes corresponding to the reference result and a second group of nodes corresponding to the to-be-compared execution result; comparing the first group of nodes and the second group of nodes one by one; when the first group of nodes and the second group of nodes are completely consistent, determining that the test result is test passed; 3. The method of claim 2, wherein, when the first group of nodes and the second group of nodes are not completely consistent, determining that the test result is test failed, and determining a highest similarity of the first group of nodes and the second group of nodes. the comparing the first group of nodes and the second group of nodes one by one comprises: determining node types of at least one node in the first group of nodes and the second group of nodes; When the node type of the at least one node is an object or a basic data type or a null type, comparing whether at least one node in the first group of nodes and the second group of nodes is equal, and updating the similarity of the corresponding parent node according to the comparison result, and determining the test result according to the similarity of the highest parent node; When the node type of the at least one node is an array, determining the index number and the maximum similarity of the most similar sub-node of the element in the second array compared with the element in the first array; Determining the test result according to the maximum similarity; The first array is a node array in the first group of nodes, and the second array is a node array corresponding to the first array in the second group of nodes.
4. The method of claim 3, wherein, When the node type of the at least one node is an object, after the similarity of the parent node is updated according to the comparison result, the method further comprises: Using a depth-first traversal algorithm to traverse the child nodes of the at least one node; For the child nodes of the at least one node, performing the operation of determining the node type of the child node of at least one node in the first group of nodes and the second group of nodes.
5. The method of claim 1, wherein, When the original execution result and the to-be-compared execution result are in a text format / data stream format, the comparing the reference result and the to-be-compared execution result to obtain a test result comprises: Comparing the reference result and the to-be-compared execution result one by one according to the character order; When there is an inconsistent character / byte, determining that the test result is a test failure, and outputting the inconsistent character; When the characters / bytes of the reference result and the to-be-compared execution result are completely the same, determining that the test result is a test pass.
6. The method of claim 1, wherein, When the to-be-tested software calls Dubbo interface interaction data, the method of obtaining the log file of the to-be-tested software comprises: Receiving the log file sent by a Dubbo filter component introduced by the to-be-tested software, the Dubbo filter component being a component introduced by the original version software.
7. The method of claim 6, wherein, The method of obtaining a corresponding new execution result based on the request parameter of the traffic data comprises: Obtaining the class name and method name of the Dubbo interface in the log file; Based on the class name and method name of the Dubbo interface, obtaining domain name information of the Dubbo interface in the to-be-tested version; Based on the domain name information, class name and method name of the Dubbo interface, sending a hypertext transfer protocol request message to the to-be-tested version; Receiving a new execution result returned by an http2Dubbo component in the to-be-tested version according to the hypertext transfer protocol request message, the http2Dubbo component being a component introduced by the to-be-tested version, and the http2Dubbo component being used to parse information of a Dubbo interface and call the Dubbo interface.
8. A software testing apparatus, characterized by comprising: The device is applied to a traffic playback test platform, the traffic playback test platform introduces a Dubbo filter component in an original version software of a to-be-tested software, and introduces an http2Dubbo component in a to-be-tested version of the to-be-tested software. The first obtaining module is configured to obtain a log file of the software to be tested, the log file comprising a request parameter and an original execution result of traffic data of the software to be tested, wherein the traffic data is traffic data in an original version of the software to be tested, and the traffic data is obtained through a Dubbo filter component introduced in the original version of the software to be tested. The second obtaining module is configured to obtain a corresponding new execution result based on the request parameter of the traffic data, the new execution result being an execution result of the traffic data in a version to be tested of the software to be tested, and the new execution result being a result returned by an http2 Dubbo component in the version to be tested, the http2 Dubbo component being configured to parse information of a Dubbo interface and call the Dubbo interface. The data structure conversion module is configured to convert a data structure of a result to be converted to be consistent with a data structure of a reference result when the data structures of the original execution result and the corresponding new execution result are different, to obtain a result to be compared. The comparison module is configured to compare the reference result and the result to be compared to obtain a test result. The output module is configured to output the test result. When the result to be converted is the new execution result, the reference result is the original execution result; and when the result to be converted is the original execution result, the reference result is the new execution result. The device further comprises a first receiving module configured to receive a data structure conversion rule pre-configured for the software to be tested. The data structure conversion module comprises: A compiling submodule configured to dynamically compile the data structure conversion rule to obtain a data structure conversion tool. A conversion submodule configured to convert the data structure of the result to be converted according to the data structure conversion rule to obtain the result to be compared.
9. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are executed by the processor to implement the method of any one of claims 1-7.
Citation Information
Patent Citations
Regression test method, device, medium and electronic equipment
CN111666201A
Data traffic test method and device, electronic equipment and storage medium
CN112527568A