A method and device for recording and playback testing
By collecting and recording test data before and after multi-interface operation, the problem of low multi-interface recording and playback testing in the existing technology is solved, and an efficient and accurate test process is achieved.
Patent Information
- Application Number
- CN202010613970.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2040-06-30
AI Technical Summary
It is difficult for the prior art to perform multi-interface recording and playback tests efficiently and accurately, especially when multi-interface traffic playback tests are connected in series.
By collecting the first data before the multi-interface operation and the second data after the multi-interface operation, the test data of each interface is recorded for playback testing. The first data includes inputting the use case variable parameters of each interface, and the second data includes request messages and response messages of each interface, making the test process more efficient.
It realizes efficient and accurate recording and playback testing of multiple interfaces, and can directly test the target interface without having to test other interfaces, saving resources and improving testing efficiency.
Smart Images

Figure CN111767227B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial technology (Fintech), and in particular, to a method and device for recording and playback testing. Background Art
[0002] With the development of computer technology, more and more technologies (such as distributed architecture, cloud computing, or big data) are applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also put forward for big data technology.
[0003] Currently, the step process for subsystem testing is generally divided into two parts, namely interface recording testing and interface playback testing.
[0004] The interface recording testing specifically includes the following steps:
[0005] 1. Configure corresponding identifiers for the request messages to be played back.
[0006] 2. Send the request messages.
[0007] 3. After the interface responds, persistently store the request messages and the reference messages obtained by the response in a database.
[0008] The interface playback testing specifically includes the following steps:
[0009] 1. Trigger the interface playback testing through the identifier corresponding to the configured request message.
[0010] 2. Obtain the interface request messages through the identifier corresponding to the request messages.
[0011] 3. Send the obtained interface request messages.
[0012] 4. Collect the response messages corresponding to the request messages.
[0013] The above solution is for single subsystem traffic playback testing and cannot concatenate multi-subsystem multi-interface traffic playback testing. Summary of the Invention
[0014] The present application provides a method and device for recording and playback testing to solve the problem of how to efficiently and accurately perform recording and playback testing of multiple interfaces.
[0015] In a first aspect, an embodiment of the present application provides a method for recording testing, including:
[0016] Generate test requests for the multiple interfaces based on test cases;
[0017] Generate test requests for the multiple interfaces based on test cases;
[0018] Collect test data of each interface when running the test request on the multiple interfaces; wherein, for the (i + 1)-th interface having a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes first data collected after the i-th interface runs and before the (i + 1)-th interface runs and second data collected after the (i + 1)-th interface runs; the first data includes the case variable parameters input to the (i + 1)-th interface; the second data includes the request message of the (i + 1)-th interface and the response message of the (i + 1)-th interface.
[0019] Record the test data of each interface for the playback test of each interface.
[0020] In the above solution, by collecting the first data before each interface runs and the second data after each interface runs, and the first data includes the case variable parameters input to each interface, and the second data includes the request message of each interface and the response message of each interface, when testing multiple interfaces, it is decoupled from other interfaces, that is, the target interface can be directly tested instead of having to test other interfaces when testing the target interface, making the test process more efficient.
[0021] Optionally, the method further includes: the recording of the test data of each interface includes:
[0022] Determine a database for recording the test data of each interface according to the test version of each interface;
[0023] Determine a data table in the database for recording the test data of each interface according to the operating environment of each interface;
[0024] Record the test data of each interface in the data table of the database.
[0025] In the above solution, by determining a database for recording the test data of each interface according to the test version of each interface and determining a data table in the database for recording the test data of each interface according to the operating environment of each interface, based on the sharding strategy, the test data of each interface is more organized when recording, improving the efficiency and accuracy of subsequent tests.
[0026] In a second aspect, an embodiment of the present application provides a method for playback testing, including:
[0027] Determine the interface to be played back;
[0028] Search for the test data of the interface; the test data of the interface includes the first data collected after the interface on which the interface depends runs and before the interface runs during the recording test, and the second data collected after the interface runs during the recording test; the first data includes the case variable parameters input to the interface; the second data includes the request message of the interface and the response message of the interface;
[0029] Perform a playback test on the interface according to the case variable parameters of the interface and the request message of the interface to obtain the playback response message of the interface;
[0030] Determine the playback result according to the response message of the interface and the playback response message of the interface.
[0031] In the above solution, by searching for the test data of the interface through the first data collected before the interface runs and the second data collected after the interface runs during the recording test, the efficiency of the playback test is improved. At the same time, when testing multiple interfaces, it is decoupled from other interfaces, that is, the target interface can be directly tested, making the test process more efficient and saving resources.
[0032] Optionally, the determining of the interface to be played back includes:
[0033] Determine the test version of the interface and the operating environment of the interface;
[0034] Searching for the test data of the interface includes:
[0035] Determine the data table in the database that records the test data of the interface according to the test version of the interface and the operating environment of the interface;
[0036] Search for the test data of the interface from the data table in the database.
[0037] In the above solution, by determining the data table in the database that records the test data of the interface according to the test version of the interface and the operating environment of the interface, and searching for the test data of the interface from the data table in the database, based on the sharding and partitioning strategy, the test data of the interface is more organized when recording, improving the efficiency and accuracy of subsequent tests.
[0038] Optionally, the method further includes:
[0039] Record the playback response message of the interface in the test data of the interface.
[0040] In the above solution, recording the last N responses makes the test data more complete and reliable.
[0041] Optionally, determining the playback result according to the response message of the interface and the playback response message of the interface includes:
[0042] Traversing the response message of the interface based on the depth-first algorithm to obtain the first parameter path and the first parameter value;
[0043] Traversing the playback response message of the interface based on the depth-first algorithm to obtain the second parameter path and the second parameter value;
[0044] Determining the playback result according to the comparison result of the first parameter path and the second parameter path, and the comparison result of the first parameter value and the second parameter value under the same parameter path.
[0045] In the above solution, the response message of the interface and the playback response message of the interface are compared based on the depth-first algorithm, so that the playback result is more accurate and the test efficiency is improved.
[0046] In a third aspect, an embodiment of the present application provides a device for recording tests, and the device includes:
[0047] An acquisition module that generates a test request for the multi-interface based on a test case; acquires test data of each interface when the test request is run on the multi-interface; wherein, for the (i + 1)-th interface that has a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes first data acquired after the i-th interface runs and before the (i + 1)-th interface runs and second data acquired after the (i + 1)-th interface runs; the first data includes the case variable parameters input to the (i + 1)-th interface; the second data includes the request message of the (i + 1)-th interface and the response message of the (i + 1)-th interface;
[0048] A recording module for recording the test data of each interface for the playback test of each interface.
[0049] Optionally, the recording module is specifically used for:
[0050] Determining a database for recording the test data of each interface according to the test versions of each interface;
[0051] Determining a data table in the database for recording the test data of each interface according to the operating environments of each interface;
[0052] Recording the test data of each interface in the data table of the database.
[0053] In a fourth aspect, an embodiment of the present application provides a device for playback testing, and the device includes:
[0054] An acquisition module, configured to determine an interface to be replayed and find test data of the interface; the test data of the interface includes first data collected after an interface on which the interface depends runs and before the interface runs during a recording test, and second data collected after the interface runs during the recording test; the first data includes use case variable parameters input to the interface; the second data includes a request message of the interface and a response message of the interface.
[0055] A processing module, configured to perform a replay test on the interface according to the use case variable parameters of the interface and the request message of the interface, and obtain a replay response message of the interface.
[0056] Determine a replay result according to the response message of the interface and the replay response message of the interface.
[0057] Optionally, the acquisition module is specifically configured to:
[0058] Determine a test version of the interface and an operating environment of the interface;
[0059] Finding the test data of the interface includes:
[0060] Determine a data table of a database that records the test data of the interface according to the test version of the interface and the operating environment of the interface;
[0061] Find the test data of the interface from the data table of the database.
[0062] Optionally, the processing module is further configured to:
[0063] Record the replay response message of the interface in the test data of the interface.
[0064] Optionally, the processing module is specifically configured to:
[0065] Traverse the response message of the interface based on a depth-first algorithm to obtain a first parameter path and a first parameter value;
[0066] Traverse the replay response message of the interface based on a depth-first algorithm to obtain a second parameter path and a second parameter value;
[0067] Determine the replay result according to a comparison result between the first parameter path and the second parameter path, and a comparison result between the first parameter value and the second parameter value under the same parameter path.
[0068] Correspondingly, an embodiment of the present invention further provides a computing device, including:
[0069] A memory, configured to store program instructions;
[0070] A processor is configured to call program instructions stored in the memory and execute the method for the recording and playback test according to the obtained program.
[0071] Correspondingly, an embodiment of the present invention further provides a computer-readable non-volatile storage medium, including computer-readable instructions. When a computer reads and executes the computer-readable instructions, the computer is caused to execute the method for the recording and playback test. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0073] Figure 1 It is a system framework of a method for a recording test provided by an embodiment of the present invention;
[0074] Figure 2 It is a flowchart of a method for a recording test provided by an embodiment of the present invention;
[0075] Figure 3 It is a schematic diagram of sub-library and sub-expression of a method for a recording test provided by an embodiment of the present invention;
[0076] Figure 4 It is a system framework of a method for a playback test provided by an embodiment of the present invention;
[0077] Figure 5 It is a flowchart of a method for a playback test provided by an embodiment of the present invention;
[0078] Figure 6 It is a schematic structural diagram of a device for a recording test provided by an embodiment of the present invention;
[0079] Figure 7 It is a schematic structural diagram of a device for a playback test provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0080] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.
[0081] First, some terms in this application are explained to facilitate understanding by those skilled in the art.
[0082] Test case: It refers to the description of the test task for a specific software product, mainly referring to the test cases related to interface testing here.
[0083] Playback test: Test the system interface of the future version based on the test data of the system interface of the previous version.
[0084] Before introducing the embodiments of the present invention, the prior art is described below in combination with specific embodiments to better understand the present invention.
[0085] The step flow of the prior art solution mainly focuses on single interface traffic recording and traffic playback.
[0086] For example, when testing multiple interfaces, the prior art divides multiple interfaces into multiple single interfaces and tests them in sequence.
[0087] For example, when testing interfaces 1, 2, and 3, in the prior art, when recording, first configure the traffic identifier A for interface 1, collect the traffic of interface 1 and store it; that is, collect the request message input to interface 1 and the response message output by interface 1; then configure the traffic identifier B for interface 2, with interface 1 as the entrance and interface 2 as the exit, collect the traffic of interface 2 and store it; that is, collect the request message input to interface 1 and the response message output by interface 2. Finally, configure the traffic identifier C for interface 3, and through interfaces 1 and 2, collect the traffic of interface 3 and store it; that is, collect the request message input to interface 1 and the response message output by interface 3.
[0088] Similarly, in the prior art, when playing back, first obtain the traffic of interface 1 according to the traffic identifier A for playback, then obtain the traffic of interface 2 according to the traffic identifier B for playback, and finally obtain the traffic of interface 3 according to the traffic identifier C for playback.
[0089] It can be seen from the above solution that when only interface 3 needs to be tested, interfaces 1 and 2 still need to be played back in sequence first.
[0090] Based on this, the embodiments of the present invention provide a method for recording tests. The method for recording tests provided by the embodiments of the present invention can be applicable to the Figure 1 system architecture as shown. The system architecture includes a requestor 100, a system under test 200, and a collection memory 300.
[0091] Among them, the requestor 100 generates test requests for multiple interfaces of multiple systems under test 200 based on test cases.
[0092] The collection memory 300 is used to collect test data of each interface when multiple systems under test 200 run test requests.
[0093] The acquisition memory 300 is used to record the test data of each interface for the playback test of each interface.
[0094] It should be noted that Figure 1 This is only an example of the system architecture of the embodiments of the present application, and the present application does not make specific limitations thereto.
[0095] Based on the system architecture shown above Figure 2 FIG. is a schematic flowchart corresponding to a method for recording tests provided by an embodiment of the present invention, and is applicable to the recording test of multiple interfaces with dependency relationships, such as Figure 2 As shown, the method includes:
[0096] Step 201, generating a test request for multiple interfaces based on a test case.
[0097] Step 202, collecting the test data of each interface when the multiple interfaces run the test request.
[0098] It should be noted that, among them, for the (i + 1)-th interface that has a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes the first data collected after the i-th interface runs and before the (i + 1)-th interface runs, and the second data collected after the (i + 1)-th interface runs; the first data includes the case variable parameters input to the (i + 1)-th interface; the second data includes the request message of the (i + 1)-th interface and the response message of the (i + 1)-th interface.
[0099] Step 203, recording the test data of each interface for the playback test of each interface.
[0100] In the embodiment of the present application, in step 201, the specific steps for configuring the test case are as follows:
[0101] S2011, configuring the test steps, test version and operating environment of the test case.
[0102] It should be noted that each test step corresponds to an interface of the system under test, and the process of configuring the test steps is the process of configuring the test order of multiple interfaces of the system under test.
[0103] For example, for three interfaces P, Q, and R, there are a total of 6 test orders, namely PQR, PRQ, QRP, QPR, RPQ, and RQP. It can be seen that in the orders of PQR and PRQ, interface Q is the test step 2 and test step 3 respectively.
[0104] In a possible implementation manner, the test step may be an interface of the system under test and an auxiliary function.
[0105] Furthermore, the test case needs to configure the test version and operating environment.
[0106] In the embodiments of the present application, after the test steps, test versions, and operating environments of the test cases are configured, the test cases are triggered to run.
[0107] It should be noted that the triggering of the test case to run can be manually triggered or preset for timed triggering, and the present application does not make specific limitations on this.
[0108] In step 202 of the embodiments of the present application, in a possible implementation manner, test data of each interface is collected through aspect-oriented programming technology (AOP).
[0109] Specifically, for the test cases that need to be replayed, in a possible implementation manner, the AOP technology is used to mount the test case collection program to the program that runs the test cases. The collection program will collect the test data once, that is, the first data, before the execution of the test steps of the test cases, and collect the test data once, that is, the second data, after the execution. In another possible implementation manner, the AOP technology is used to collect the test data once before and after the execution of the test steps of the test cases through the collection storage server, as Figure 3 shown.
[0110] It should be noted that, in a possible implementation manner, the first data includes the case variable parameters of the input interface, and the second data includes the request message of the interface and the response message of the interface. In another possible implementation manner, the first data includes the case variable parameters of the input interface and the request message of the interface, and the second data includes the response message of the interface.
[0111] Further, in step 203, the test data of each interface is recorded for the replay test of each interface;
[0112] Specifically, the database for recording the test data of each interface is determined according to the test version of each interface;
[0113] The data table for recording the test data of each interface in the database is determined according to the operating environment of each interface;
[0114] The test data of each interface is recorded in the data table of the database.
[0115] It should be noted that the above solution uses the technology of database sharding and table partitioning to persistently store the test data according to the test version and operating environment of the interface.
[0116] In the above solution, by collecting the first data before each interface runs and the second data after each interface runs, where the first data includes the use case variable parameters input to each interface, and the second data includes the request message of each interface and the response message of each interface, when testing multiple interfaces, it is decoupled from other interfaces, that is, the target interface can be directly tested instead of having to test other interfaces when testing the target interface, making the testing process more efficient.
[0117] In an embodiment of the present application, in a possible implementation manner, the storage data format of the collected test data is shown in Table 1 (use case variable parameter traffic) and Table 2 (interface traffic).
[0118] It should be noted that Table 1 is used to indicate finding the corresponding use case variable parameters according to the use case identifier, test step, test version, and operating environment. Table 2 is used to indicate finding the corresponding request message and response message according to the use case identifier, test step, test version, and operating environment.
[0119] Table 1
[0120] Use Case Identifier Test Steps Test Version Operating Environment Use Case Variable Parameters 1001 3 1.0.0 A {"v_var1":"xxx"} 1001 4 1.0.0 A {"v_var2":"xxx"} 1001 5 1.0.0 A {"v_var3":"xxx"} 1002 3 1.0.0 B {"v_var4":"xxx"} 1002 4 1.0.0 B {"v_var5":"xxx"} 1002 5 1.0.0 B {"v_var6":"xxx"}
[0121] As can be seen from Table 1, for example, according to the test version 1.0.0 and the operating environment B, determine the database for recording the test data of the interface, and then according to the use case identifier 1002 and the test step 3, determine the data table for recording the test data of the interface in the database, and the corresponding use case variable parameters {"v_var4": "xxx"} can be found.
[0122] Table 2
[0123]
[0124]
[0125] As can be seen from Table 2, for example, according to the test version 1.0.0 and the operating environment A, determine the database for recording the test data of the interface, and then according to the use case identifier 1001 and the test step 4, determine the data table for recording the test data of the interface in the database, and the corresponding interface identifier is 01100002, the request message is {"param1": "xxx", "param2": "xxx"}, the current response message is {"code": "xxx", "message": "xxx"}, and the most recent first response message is {"code": "xxx", "message": "xxx"}.
[0126] Furthermore, determine the database sharding and table partitioning strategy based on the test version and operating environment, as Figure 3 shown.
[0127] From Figure 3 It can be seen that the interface with the interface identifier 01100001 corresponds to the serial number 1 of the test step, the interface with the interface identifier 01100002 corresponds to the serial number 2 of the test step, the test version corresponding to database S is 1.2.X, the test version corresponding to database T is 1.3.X, the data table a corresponds to the test version 1.2.67, and the test environment A; the data table b corresponds to the test version 1.3.0 and the test environment A; the data table c corresponds to the test version 1.3.0 and the test environment B.
[0128] In the above solution, by collecting the first data before the interface runs and the second data after the interface runs, and at the same time, the first data includes the case variable parameters input to the interface, and the second data includes the request message of the interface and the response message of the interface, when testing multiple interfaces, it is decoupled from other interfaces, that is, the target interface can be directly tested, making the test process more efficient.
[0129] Furthermore, the embodiment of the present invention provides a method for playback testing. The method for playback testing provided by the embodiment of the present invention can be applied to a system architecture as Figure 4 shown. The system architecture includes a requester 400, a system under test 500, a collection memory 600, and an analyzer 700.
[0130] Among them, the requester 400 is used to determine the system under test 500 to be replayed and find the test data of the system under test 500. After performing the playback test on the system under test 500, the collection memory 600 obtains the playback response message of the system under test 500.
[0131] The analyzer 700 determines the playback result according to the response message of the interface of the system under test 500 and the playback response message of the interface.
[0132] It should be noted that Figure 4 is only an example of the system architecture of the embodiment of the present application, and the present application does not make specific limitations on this.
[0133] Based on the system architecture shown above, Figure 5 is a schematic flow chart corresponding to a method for playback testing provided by an embodiment of the present invention. As Figure 5 shown, the method includes:
[0134] Step 501, determine the interface to be replayed.
[0135] Step 502, find the test data of the interface.
[0136] It should be noted that the test data of the interface includes the first data collected after the interface on which the interface depends runs and before the interface runs during the recording test process, and the second data collected after the interface runs during the recording test process; the first data includes the case variable parameters input to the interface; the second data includes the request message of the interface and the response message of the interface.
[0137] Step 503: Perform a playback test on the interface according to the case variable parameters of the interface and the request message of the interface to obtain the playback response message of the interface.
[0138] Step 504: Determine the playback result according to the response message of the interface and the playback response message of the interface.
[0139] In step 501, determine the test version of the interface and the operating environment of the interface;
[0140] Find the test data of the interface, specifically:
[0141] According to the test version of the interface and the operating environment of the interface, determine the data table of the database that records the test data of the interface;
[0142] Find the test data of the interface from the data table of the database.
[0143] In the above solution, by determining the data table of the database that records the test data of the interface according to the test version of the interface and the operating environment of the interface, and finding the test data of the interface from the data table of the database, the test data of the interface is made more organized when recording based on the sharding and partitioning strategy, improving the efficiency and accuracy of subsequent tests.
[0144] In step 502, determine the test version, operating environment, case identifier of the case, and test steps according to the playback requirements to trigger the playback.
[0145] Specifically, according to the test version, the sharding and partitioning strategy is adopted for the operating environment to obtain the test data of the interface.
[0146] In step 503, load the test data of the interface, including case variable parameters, the request message of the interface, and the response message of the interface.
[0147] After step 504, record the playback response message of the interface in the test data of the interface.
[0148] For example, test case a has test steps 3, 4, 5, 6, 7, 8, 9, 10. According to the playback requirements, trigger the playback of test step 7. During the execution of the test case, directly ignore test steps 3, 4, 5, 6, and come to test step 7. The test data obtained based on the sharding and partitioning strategy is specifically as follows:
[0149] (1) Trigger the playback of the specified test steps of the test case;
[0150] (2) Place other test steps before the test case and directly go to the target playback test step, i.e., test step 7;
[0151] (3) Extract the test version and test environment, and obtain the test data for test step 7 based on the sharding strategy, i.e., the use case variable parameters, request message, and response message.
[0152] (4) Load the use case variable parameter d, create a use case variable name-value mapping table m, traverse the use case variables that already exist in the current memory space. If the name of the use case variable i exists in the mapping table m, obtain the corresponding value v of the mapping table and replace the value of the current use case variable with v.
[0153] (5) Load the test data, obtain the request message data requestData and the most recent response message data responseDatal, responseData2, responseData3,..., responseDataN, replace the request message data of the current test step with requestDatal, and store the most recent N response messages.
[0154] In the embodiment of the present application, in step 504, traverse the response message of the interface based on the depth-first algorithm to obtain the first parameter path and the first parameter value;
[0155] Traverse the playback response message of the interface based on the depth-first algorithm to obtain the second parameter path and the second parameter value;
[0156] Determine the playback result according to the comparison result of the first parameter path and the second parameter path, and the comparison result of the first parameter value and the second parameter value under the same parameter path.
[0157] For example, compare and verify the playback response message with the response message, i.e., the reference response message, and store the playback response message.
[0158] Further, taking the json response message data format as an example for the comparison algorithm, for the playback response json message data a and the reference response json message data b, the specific steps are as follows:
[0159] 1. Based on the depth-first search algorithm, traverse the playback response json message data a, parse all parameter paths and their values, and establish a parameter path-value mapping table Ma;
[0160] 2. Based on the depth-first search algorithm, traverse the reference response json message data b, parse all parameter paths and their values, and establish a parameter path-value mapping table Mb;
[0161] 3. Based on the parameter path-value mapping table Mb, traverse all its parameter paths. For parameter path i, look up its value in the mapping table Ma. If the value does not exist or is not equal, the comparison and verification fails; if the values of all number paths in the mapping table Mb exist in the mapping table Ma and are equal, the comparison and verification passes.
[0162] In the above solution, the response message of the interface and the playback response message of the interface are compared based on the depth-first algorithm, so that the playback result is more accurate and the test efficiency is improved.
[0163] Furthermore, the embodiments of the present application can be applied to compatibility testing:
[0164] Specifically, when updating the version and requiring the new version to be compatible with the functions of the old version, compatibility testing is required at this time. According to the requirements, the test cases of the old version are specified to perform playback testing on the interfaces of the system under test of the new version. Therefore, the present application supports the compatibility testing of multiple subsystem interface versions.
[0165] Furthermore, the embodiments of the present application can be applied to big data testing:
[0166] Specifically, for big data testing, in the overall test cycle, the big data batch running, that is, the closing cycle, accounts for a relatively large proportion. The test cases provided by the present application make the post-batch verification cycle account for a relatively small proportion. The test data can be correctly tested based on the big data batch running cycle, and the post-batch verification test of the test cases can be repeatedly verified. Therefore, the present application realizes the testing of the relevant batch running processes of the bank.
[0167] In the above solution, the test data of the interface is found by the first data collected before the interface runs and the second data collected after the interface runs during the recording test process, which improves the efficiency of the playback test. At the same time, when testing multiple interfaces, it is decoupled from other interfaces, that is, the target interface can be directly tested, making the test process more efficient and saving resources.
[0168] Based on the same inventive concept, Figure 6 Exemplarily shows a recording test device provided by an embodiment of the present invention. The device can be a process of a recording test method.
[0169] The device includes:
[0170] The acquisition module 601 generates test requests for the multi-interface based on test cases; collects test data of each interface when running the test requests on the multi-interface; wherein, for the (i + 1)-th interface having a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes first data collected after the i-th interface runs and before the (i + 1)-th interface runs and second data collected after the (i + 1)-th interface runs; the first data includes use case variable parameters input to the (i + 1)-th interface; the second data includes the request message of the (i + 1)-th interface and the response message of the (i + 1)-th interface.
[0171] The recording module 602 is used to record the test data of each interface for the playback test of each interface.
[0172] Optionally, the recording module 602 is specifically used for:
[0173] Determine the database for recording the test data of each interface according to the test versions of each interface;
[0174] Determine the data table in the database for recording the test data of each interface according to the operating environment of each interface;
[0175] Record the test data of each interface in the data table of the database.
[0176] Based on the same inventive concept, Figure 7 Exemplarily shows a playback test device provided by an embodiment of the present invention, and the device can be the process of the playback test method.
[0177] The acquisition module 701 is used to determine the interface to be played back; search for the test data of the interface; the test data of the interface includes first data collected after the interface on which the interface depends runs and before the interface runs and second data collected after the interface runs during the recording test; the first data includes use case variable parameters input to the interface; the second data includes the request message of the interface and the response message of the interface.
[0178] The processing module 702 is used to perform a playback test on the interface according to the use case variable parameters of the interface and the request message of the interface to obtain the playback response message of the interface;
[0179] Determine the playback result according to the response message of the interface and the playback response message of the interface.
[0180] Optionally, the acquisition module 701 is specifically used for:
[0181] Determine the test version of the interface and the operating environment of the interface;
[0182] Search for the test data of the interface, including:
[0183] Determine the data table in the database that records the test data of the interface according to the test version of the interface and the operating environment of the interface;
[0184] Search for the test data of the interface from the data table in the database.
[0185] Optionally, the processing module 702 is further configured to:
[0186] Record the playback response message of the interface in the test data of the interface.
[0187] Optionally, the processing module 702 is specifically configured to:
[0188] Traverse the response message of the interface based on the depth-first algorithm to obtain the first parameter path and the first parameter value;
[0189] Traverse the playback response message of the interface based on the depth-first algorithm to obtain the second parameter path and the second parameter value;
[0190] Determine the playback result according to the comparison result of the first parameter path and the second parameter path, and the comparison result of the first parameter value and the second parameter value under the same parameter path.
[0191] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for realizing the functions specified in one or more flows and / or blocks Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0192] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in one or more flows and / or blocks Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0193] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions for implementing the functions specified in one process or a plurality of processes and / or blocks Figure 1 in one block or a plurality of blocks Figure 1 in one block or a plurality of blocks.
[0194] Although the preferred embodiments of the present invention have been described, additional changes and modifications can be made by those skilled in the art once they learn of the basic inventive concept. Therefore, the appended claims are intended to be construed to cover the preferred embodiments as well as all changes and modifications falling within the scope of the present invention.
[0195] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A method for recording tests, characterized in that, it is applicable to the recording tests of multiple interfaces with dependency relationships, and the method includes: generating test requests for the multiple interfaces based on test cases; separately collecting test data of each interface when the test requests are run on the multiple interfaces; wherein, for the (i + 1)-th interface that has a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes first data collected after the i-th interface runs and before the (i + 1)-th interface runs and second data collected after the (i + 1)-th interface runs; the first data includes case variable parameters input to the (i + 1)-th interface, and the case variable parameters are found based on the case identifier, test steps, test version, and operating environment of the test case; the second data includes the request message and the response message of the (i + 1)-th interface, and the request message and the response message are found based on the case identifier, test steps, test version, and operating environment of the test case; separately recording the test data of each interface for individual playback tests of each interface.
2. The method according to claim 1, characterized in that, the recording of the test data of each interface includes: determining a database for recording the test data of each interface according to the test version of each interface; determining a data table in the database for recording the test data of each interface according to the operating environment of each interface; recording the test data of each interface in the data table of the database.
3. A method for playback tests, characterized in that, the method includes: determining the interface to be played back; finding the test data of the interface; the test data of the interface includes first data collected after the interface on which the interface depends runs and before the interface runs during the recording test and second data collected after the interface runs during the recording test; the first data includes case variable parameters input to the interface, and the case variable parameters are found based on the case identifier, test steps, test version, and operating environment of the test case; the second data includes the request message and the response message of the interface, and the request message and the response message are found based on the case identifier, test steps, test version, and operating environment of the test case; performing a playback test on the interface according to the case variable parameters of the interface and the request message of the interface to obtain a playback response message of the interface; determining a playback result according to the response message of the interface and the playback response message of the interface.
4. The method according to claim 3, characterized in that, the determining of the interface to be played back includes: determining the test version of the interface and the operating environment of the interface; the finding of the test data of the interface includes: determining a data table of the database for recording the test data of the interface according to the test version of the interface and the operating environment of the interface; finding the test data of the interface from the data table of the database.
5. The method according to claim 3, characterized in that, The method further includes: Recording the playback response message of the interface in the test data of the interface.
6. The method according to claim 3, characterized in that determining the playback result according to the response message of the interface and the playback response message of the interface includes: Traversing the response message of the interface based on the depth-first algorithm to obtain a first parameter path and a first parameter value; Traversing the playback response message of the interface based on the depth-first algorithm to obtain a second parameter path and a second parameter value; Determining the playback result according to the comparison result of the first parameter path and the second parameter path and the comparison result of the first parameter value and the second parameter value under the same parameter path.
7. A device for recording tests, characterized in that being applicable to the recording test of multiple interfaces with dependency relationships, including: An acquisition module, configured to generate a test request for the multiple interfaces based on a test case; separately acquire the test data of each interface when the test request is run on the multiple interfaces; wherein, for the (i + 1)-th interface having a dependency relationship with the i-th interface, the test data of the (i + 1)-th interface includes first data acquired after the i-th interface runs and before the (i + 1)-th interface runs and second data acquired after the (i + 1)-th interface runs; the first data includes the use case variable parameters input to the (i + 1)-th interface, and the use case variable parameters are found based on the use case identifier, test steps, test version, and operating environment of the test case; the second data includes the request message and the response message of the (i + 1)-th interface, and the request message and the response message are found based on the use case identifier, test steps, test version, and operating environment of the test case; A recording module, configured to separately record the test data of each interface for the separate playback test of each interface.
8. A device for playback testing, characterized in that including: An acquisition module, configured to determine the interface to be played back; Search for the test data of the interface; The test data of the interface includes first data acquired after the interface on which the interface depends runs and before the interface runs and second data acquired after the interface runs during the recording test of the test case; the first data includes the use case variable parameters input to the interface, and the use case variable parameters are found based on the use case identifier, test steps, test version, and operating environment of the test case; the second data includes the request message and the response message of the interface, and the request message and the response message are found based on the use case identifier, test steps, test version, and operating environment of the test case; A processing module, configured to perform a playback test on the interface according to the use case variable parameters of the interface and the request message of the interface to obtain a playback response message of the interface; Determine the playback result according to the response message of the interface and the playback response message of the interface.
9. A computing device, characterized in that including: A memory, configured to store program instructions; A processor, configured to call program instructions stored in the memory and execute the method according to any one of claims 1 to 6 based on the obtained program.
10. A computer-readable non-volatile storage medium, characterized in that it includes computer-readable instructions, and when a computer reads and executes the computer-readable instructions, the computer is caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and apparatus for data recording, data playback and automatic test
CN109189665A