Interface testing method and device, equipment, storage medium and program product
By determining variable dependencies and batch execution test cases, the problems of cumbersome and inefficient processes in interface testing are solved, and efficient and accurate interface testing is achieved.
Patent Information
- Application Number
- CN202411478796.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-10
AI Technical Summary
The existing interface testing technology process is cumbersome, inefficient and error-prone, especially in large-scale software with complex dependencies, and the testing efficiency and accuracy are difficult to guarantee.
By obtaining multiple test case sets and variable sets of the target software, determining variable dependencies, batch execution of test cases in accordance with the test sequence, using the output variable response data of the predecessor case to call the post-order case, realizing the chain reaction of interface tests, and improving the Test efficiency and accuracy.
It realizes the automated execution of interface tests, improves the orderliness of the test process and the accuracy of data interaction, improves the accuracy of batch interface tests, and avoids manual triggering errors.
Smart Images

Figure CN119292939A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to an interface testing method, device, equipment, storage medium and program product. Background Art
[0002] With the continuous development of software technology, software has become more diversified and intelligent, with larger and larger scale and more and more functions. In the process of software testing, since a software may have many interfaces and there are complex dependencies between interfaces, interface testing of software is a big challenge.
[0003] Existing interface testing technologies often rely on manual triggering and execution and lack an efficient data management mechanism. For large-scale interface testing with complex dependencies, the interface currently being tested often calls the associated interface for data communication in the form of a data linked list. The process is cumbersome, inefficient and prone to errors.
[0004] Therefore, there is an urgent need to provide a new interface testing method to improve the efficiency and accuracy of interface testing. Summary of the invention
[0005] The embodiments of the present application provide an interface testing method, apparatus, equipment, storage medium and program product to solve the problems of cumbersome procedures, low efficiency and proneness to errors in existing interface testing technologies.
[0006] In a first aspect, an embodiment of the present application provides an interface testing method, comprising:
[0007] Acquire multiple test case sets of the target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case of the test case set, and different test case sets correspond to different interfaces;
[0008] Determine variable dependencies based on the relationship between input variables and output variables in the variable sets of multiple test case sets;
[0009] Execute the test cases of each test case set in the test order, and when executing the test cases of the subsequent test case set, call the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set based on the variable dependency relationship to obtain the response data of the output variable of the test case;
[0010] Record the response data of the output variables of each test case executed.
[0011] In a possible implementation, determining the variable dependency relationship based on the relationship between input variables and output variables in the variable sets corresponding to the plurality of test case sets includes:
[0012] Obtain the test requirements of the target software;
[0013] Determine the test sequence of multiple test case sets based on test requirements;
[0014] Obtaining a correspondence between input variables and output variables in a variable set of each test case set among a plurality of test case sets;
[0015] Based on the test order and correspondence, variable dependencies are determined.
[0016] In a possible implementation, the variable dependency relationship includes the name of the variable, the serial number of the test case corresponding to the output variable called by the variable, and the storage path of the response data of the output variable called by the variable.
[0017] In a possible implementation, the test cases of each test case set are executed in a test order, and when the test cases of the subsequent test case set are executed, based on the variable dependency, the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set is called to obtain the response data of the output variable of the test case, including:
[0018] In accordance with the test sequence, each test case set is executed to obtain the response data of the output variables of each test case set, and the response data of the output variables of each test case set is pre-stored in the snapshot table; and when executing the test cases of the subsequent test case set, based on the variable dependency, the response data of the output variables corresponding to the input variables of the test case are read to obtain the response data of the output variables of the test case.
[0019] In a possible implementation, the interface testing method further includes:
[0020] The response data of the output variables of each executed test case are compared with the corresponding expected data to obtain the test results.
[0021] In a possible implementation manner, after comparing the response data of the output variables of each executed test case with the corresponding expected data to obtain the test result, the method further includes:
[0022] Test results are sent via email to project stakeholders, including developers, testers, and project managers.
[0023] In a second aspect, an embodiment of the present application provides an interface testing device, comprising:
[0024] A test case set preparation module, used to obtain multiple test case sets of the target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case in the test case set, and different test case sets correspond to different interfaces;
[0025] A variable dependency determination module, used for determining variable dependencies based on the relationship between input variables and output variables in the variable sets of multiple test case sets;
[0026] A test case calling module is used to execute the test cases of each test case set in accordance with the test sequence, and when executing the test cases of the subsequent test case set, based on the variable dependency, call the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set to obtain the response data of the output variable of the test case;
[0027] The response data recording module is used to record the response data of the output variables of each executed test case.
[0028] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0029] Memory stores computer-executable instructions;
[0030] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.
[0032] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.
[0033] An interface testing method, apparatus, device, storage medium and program product provided by the embodiments of the present application, after obtaining multiple test case sets of target software and variable sets of each test case set, determine variable dependencies based on the relationship between input variables and output variables in the variable sets of multiple test case sets; batch execute test cases of each test case set according to the test sequence, and when executing test cases of subsequent test case sets, use the variable dependencies to call the response data of the output variables of the previous test case set corresponding to the input variables of the test case, and obtain the response data of the output variables of the test cases of the subsequent test case set, so as to realize the automatic execution of batch test cases of multiple interfaces without relying on manual triggering and execution of each interface. At the same time, through the means of variable sets and variable dependencies, a chain reaction of the entire target software interface test is realized, thereby improving the orderliness of the test process and the accuracy of data interaction, thereby improving the accuracy of batch interface testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0035] Figure 1 A schematic diagram of an application scenario provided for this application;
[0036] Figure 2 A schematic diagram of the process of an interface testing method provided in this application Figure 1 ;
[0037] Figure 3 A schematic diagram of the variable calling method between test cases provided by this application;
[0038] Figure 4 A schematic diagram of the process of an interface testing method provided in this application Figure 2 ;
[0039] Figure 5 A schematic diagram of the interface test extension method provided for this application;
[0040] Figure 6 A schematic diagram of the structure of the interface testing device provided in this application;
[0041] Figure 7 A schematic diagram of the structure of an electronic device provided in this application.
[0042] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0043] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0044] First, the terms involved in this application are explained:
[0045] An interface is a set of rules and specifications that define how different software components communicate and interact with each other, allowing developers to exchange data and call functions between different software applications.
[0046] A test case, also known as a test use case, is a set of request data, execution conditions, and expected data designed to verify whether a software system or a function in a software system works as expected. The request data is the input data of the test case.
[0047] Figure 1 A schematic diagram of an application scenario provided by this application. Figure 1 As shown, in order to implement software interface testing, it is necessary to run test cases through the interface testing framework to test the functions and performance of the target software interface.
[0048] The interface testing framework is a framework designed based on the testing method provided in this application, which stores n test cases; the target software is the software to be tested, which can be any software or a partial functional module of the software. The target software contains m interfaces, and m and n are both positive integers greater than 1.
[0049] The interface testing framework communicates and interacts with the target software, calls the corresponding interface of the target software through running test cases, and returns the response data of the corresponding interface to the interface testing framework to verify whether the function and performance of the interface meet expectations.
[0050] The interfaces of the target software are often related, and the response data of one interface may be used as the request data of another interface. Therefore, in interface testing, it is necessary not only to test whether the functions of each interface are correct, but also to test whether the data transmission between interfaces is correct.
[0051] Based on the above application scenarios, it can be seen that the interface testing method can ensure the accuracy and reliability of the target software. Especially when it comes to the financial industry, once the financial software makes a mistake, it may cause great economic losses. For example, assuming a financial platform, users need to log in first, then obtain financial information, check the user's investment situation, and finally choose to buy / sell. This process may involve multiple interfaces, such as login interface, information acquisition interface, buy / sell interface, and query operation record interface. The above interfaces are all related. If the data transmission of one interface is wrong or the interface response is wrong, it will cause great losses. Therefore, it is particularly important to provide a highly reliable and accurate interface testing method.
[0052] In existing interface testing technologies, a single interface is usually tested. When testing multiple related interfaces, data is often transmitted between interfaces and the test of the next interface is triggered manually. For software with complex interface dependencies, the data management mechanism is complex. The use of manual triggering is prone to interface triggering errors or missing some interfaces, resulting in poor test accuracy. At the same time, the manual triggering method is also inefficient and cannot meet the needs of large-scale interface testing.
[0053] In view of the above problems, an interface testing method provided by an embodiment of the present application, after obtaining multiple test case sets of target software and variable sets of each test case set, determines the variable dependency relationship between variables through the variable set of each interface; in accordance with the test order, batch executes the test cases of each test case set, the input variable of the test case of the subsequent test case set calls the response data of the output variable of the preceding test case set corresponding to the input variable, obtains the response data of the output variable of the test case of the subsequent test case set, and compares it with the expected data to obtain the test result. The method can flexibly define the association relationship of each interface through the variable set and the variable dependency relationship, can accurately manage and transmit data, can solve the problem that the test process design is cumbersome and error-prone due to the complexity of the interface dependency relationship, and improves the accuracy of the interface test; through the test order and the method of batch executing the test cases of each test case set, a chain reaction of the test of each interface of the target software can be realized, and all test cases can be automatically triggered and executed, without relying on manual triggering and execution of each interface test, which can improve the test efficiency of the interface test.
[0054] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0055] Figure 2A schematic diagram of an interface testing method provided in this application Figure 1 ,like Figure 2 As shown, the method includes:
[0056] Step S201: Acquire multiple test case sets of the target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case of the test case set, and different test case sets correspond to different interfaces.
[0057] The target software is the software to be tested, which can be any software, such as financial software, shopping software, etc. The test case set is a collection of test cases used to test a certain interface, and the test case includes request data, execution conditions, and expected data.
[0058] The variable set of each test case set is a set of variables of each test case in the corresponding test case set, wherein the variables include input variables and output variables, the request data of each test case in the test case set is stored in the input variables of the variable set of the test case set, and the response data after the execution of each test case in the test case set is stored in the output variables of the variable set of the test case set.
[0059] Specifically, in the current version, there are multiple interfaces to be tested in the target software. The test requirements of each interface are different. Different interfaces can correspond to different test cases. The test cases corresponding to each interface constitute the test case set of the interface. Each test case set maintains the variable set of the test case set, where maintenance includes operations such as creating variables and assigning values to variables. When creating a variable, the created variable will be assigned a variable address pointing to the storage path, thereby realizing data reading and writing.
[0060] Exemplarily, assuming that the interface to be tested in the target software includes a login interface, the test cases for the login interface may include: a test case for a valid login, a test case for an invalid login, etc., and the above test cases constitute a test case set for the login interface. The variables of the variable set of the test case set for the login interface are the request data and response data of the above test cases, such as usename_i, password_i, status_i and token_i, etc., where usename_i represents the user name entered by the user; password_i represents the password entered by the user; status_i represents the status data returned by the user login interface, which may include two states: successful login and failed login; token_i represents the token data returned by the user login interface after a successful login, which is the user's identity authentication, so that the user does not need to enter the username and password again when accessing within the valid time; i represents the serial number of the test case corresponding to the variable, which is used to distinguish the variables of different test cases. The above examples are only exemplary, and the specific test case set and variable set need to be determined according to the test scenario.
[0061] The interface testing method of the present application introduces a test case set and a variable set of the test case set, and classifies and manages the test cases, request data of the test cases, and response data of the test cases in the interface test, so as to facilitate unified management and data transmission. If the test requirements change, the test cases of the interface affected by the change and the data affected by the change can be quickly located to achieve rapid response. The scope of the variable set is within the test case and will not be accidentally modified by other programs, and the problem of naming conflicts is avoided.
[0062] Step S202: Determine variable dependencies based on the relationships between input variables and output variables in the variable sets corresponding to the multiple test case sets.
[0063] Among them, the variable dependency is the data transfer between two test cases, which means that the input variable corresponding to the request data of one test case and the output variable corresponding to the response data of another test case have a variable dependency relationship. For example, the input variable token_21 in a test case of the information acquisition interface needs to call the response data of the output variable token_11 of the test case of the valid login in the login interface, so there is a variable dependency relationship between token_21 and token_11.
[0064] The method for determining variable dependencies can be based on data transmission between multiple interfaces, determine the input variables and output variables in the variable set corresponding to the test case set corresponding to each request data and response data, obtain the relationship between the input variables and output variables in the variable set corresponding to multiple test case sets, and finally determine the variable dependencies.
[0065] Optionally, based on the relationship between input variables and output variables in the variable sets corresponding to the multiple test case sets, the variable dependency relationship is determined, including:
[0066] Obtain the test requirements of the target software; determine the test order of multiple test case sets based on the test requirements; obtain the correspondence between input variables and output variables in the variable set of each test case set in the multiple test case sets; determine the variable dependency based on the test order and the correspondence.
[0067] The test order of multiple test case sets can be specified manually or determined based on the order of data transfer between interfaces in the test requirements.
[0068] Exemplarily, there are four interfaces, namely interface 1 to interface 4, and the corresponding test case sets are test case set 1 to test case set 4. Assuming that the response data of test interface 1 is transmitted to interface 2, the response data of interface 2 is transmitted to interface 3, and the response data of interface 3 is transmitted to interface 4, then the test order of the test case set is, from first to last, test case set 1 corresponding to interface 1, test case set 2 corresponding to interface 2, test case 3 corresponding to interface 3, and test case 4 corresponding to interface 4. Assuming that the response data of test interface 1 is transmitted to interfaces 2 and 3, and the response data of interface 2 is transmitted to interface 4, then the test order of the test case set can be, first execute test case set 1, execute test case sets 2 and 3 in parallel, and then execute test case set 4. Or the four test case sets are executed serially, and the test order can be: test case set 1-test case set 2-test case set 3-test case set 4, or, test case set 1-test case set 2-test case set 4-test case set 3, or test case set 1-test case set 3-test case set 2-test case set 4. That is, under the premise of maintaining the sequence of test case set 1, test case set 2 and test case set 4, test case set 3 is executed at any position after test case set 1.
[0069] The method for determining the test order is not unique. It only needs to ensure that the order of the test cases in the test case set is after the test case set corresponding to the output variable called by the input variable of the test case. If there is an independent interface to be tested, the test order of the test case set corresponding to the interface can be set arbitrarily, for example, before, after or in the middle of other test case sets. This determination method can be determined using an algorithm.
[0070] According to the test sequence, to obtain the input variables of the test cases in the subsequent test case set, it is necessary to call the output variables after the execution of the previous test case set. According to the calling relationship between the above input variables and output variables, the variable dependency relationship between the two test cases is determined. By traversing each test case, the complete variable dependency relationship can be obtained.
[0071] The preceding test case set and the succeeding test case set are relative concepts. In the test sequence, the preceding test case set is executed before the succeeding test case set. Taking the test case set 1 and the test case set 2 in the aforementioned embodiment as an example, the test case set 1 is the preceding test case set, and the test case set 2 is the succeeding test case set.
[0072] Optionally, the variable dependency includes the name of the variable, the serial number of the test case corresponding to the output variable called by the variable, and the storage path of the response data of the output variable called by the variable.
[0073] For test cases other than the first test case, when executing the test case, based on the name of the input variable of the test case, the serial number of the test case corresponding to the variable called by the name of the variable and the storage path of the response data of the called variable are searched from the variable dependency.
[0074] The variable dependency can be configured in the configuration file in the format of <previous test case serial number, JsonPath>->variable name, where "variable name" is the name of the variable, "previous test case serial number" is the serial number of the test case corresponding to the output variable of the variable call corresponding to "variable name", and "JsonPath" is the variable address of the output variable of the variable call corresponding to "variable name", and the variable address points to a storage path for storing the response data of the corresponding variable. Taking the variable dependency of the input variable token_21 in a test case of the information acquisition interface in the aforementioned embodiment and the output variable token_11 of the valid login test case in the login interface as an example, in the configuration table, the format of the variable dependency of token_21 is <valid login test case serial number, storage path of token_11>->token_21.
[0075] In this embodiment, based on the testing requirements of the software, variable dependencies between the test case sets corresponding to each interface are defined. By defining the variable dependencies between the test cases, the variable dependencies between the input variables of one test case and the output variables of another test case are defined, and there is no need to consider the variables of other test cases. The method is more concise and accurate. The variable dependencies support more flexible configuration methods, thereby supporting more flexible testing schemes. For example, when the target software is updated, any variable dependencies can be redefined without affecting the logic of the entire interface test. Through the variable dependencies defined in the configuration file, the variables directly reference the storage address of the called output variables. The method is more transparent and accurate, avoiding the error caused by other test cases executing them and causing errors when calling other test cases.
[0076] Step S203: execute the test cases of each test case set in accordance with the test order, and when executing the test cases of the subsequent test case set, call the response data of the output variables corresponding to the input variables of the test case in the variable set of the previous test case set based on the variable dependency relationship to obtain the response data of the output variables of the test case.
[0077] In this step, the test cases are executed in batches. Specifically, the test cases of each test case set are executed in the test order, and variable values are passed between different test case sets. When the subsequent test case set is executed, the output variables of the previous test case set corresponding to the input variables of the subsequent test case set are called according to the variable dependency relationship to obtain the response data of the output variables of the subsequent test case set.
[0078] For example, Figure 3 This is a schematic diagram of the variable calling method between test cases provided by this application. Figure 3 As shown, it is assumed that the target software has 4 interfaces, interface 1, interface 2, interface 3 and interface 4. The test case sets corresponding to interfaces 1 to 4 are test case sets 1 to test case sets 4, respectively. There are 5 test cases under each test case set, which can also be other numbers. The number of test cases in different test case sets can also be different. According to the variable dependency relationship, the response data of the corresponding output variables are called in the test cases of each test case set. The input variables of test cases 21 to 25 call variable 11 of test case 11, the input variables of test cases 31 to 35 call variable 22 of test case 22, and test case 33 also calls variable 13 of test case 13. The input variables of test cases 41 to 45 call variable 33 of test case 33, and the input variables of test case 45 call variable 24 of test case set 24.
[0079] In this embodiment, batch execution of test cases is achieved by calling previous test cases by subsequent test cases, forming a chain reaction mechanism for each interface, which can ensure that no interface is missed, ensure the logical coherence and deep coverage of the test process, and ensure the comprehensiveness of the test.
[0080] S204: Record the response data of the output variables of each executed test case.
[0081] In this step, when each test case is executed, the response data of the currently executed test case is obtained, updated to the corresponding output variable in the snapshot table, and the results of the test process are recorded.
[0082] Optionally, the snapshot table can be used to store variables of response data that need to be transmitted during the test process. For example, when the output variable value of a test case is called by a test case in a subsequent test case set, the output variable is written into the snapshot table.
[0083] In this embodiment, by writing the output variables of each test case into the snapshot table, the response data of the test case during the test process can be supervised and checked. If the final test result is wrong, the data in the snapshot table can be checked to quickly locate the wrong test case and interface, thereby improving the efficiency of interface testing.
[0084] An interface testing method provided by an embodiment of the present application, after obtaining multiple test case sets of target software and variable sets of each test case set, determines variable dependencies based on the relationship between input variables and output variables in the variable sets of the multiple test case sets; batch executes test cases of each test case set according to the test sequence, and when executing test cases of subsequent test case sets, calls the response data of the output variables of the preceding test case set corresponding to the input variables of the test case by utilizing the variable dependencies, and obtains the response data of the output variables of the test cases of the subsequent test case set, thereby realizing automatic execution of batch test cases of multiple interfaces without relying on manual triggering and execution of each interface, and at the same time, realizing the chain reaction of the entire target software interface test by means of variable sets and variable dependencies, thereby improving the orderliness of the test process and the accuracy of data interaction, and thus improving the accuracy of batch interface testing.
[0085] Optionally, the above step S203, executing the test cases of each test case set in the test order, and when executing the test cases of the subsequent test case set, calling the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set based on the variable dependency relationship to obtain the response data of the output variable of the test case, may include:
[0086] In accordance with the test sequence, each test case set is executed to obtain the response data of the output variables of each test case set, and the response data of the output variables of each test case set is pre-stored in the snapshot table. When executing the test cases of the subsequent test case set, based on the variable dependency, the response data of the output variables corresponding to the input variables of the test case are read from the variable address of the variable set of the previous test case set to obtain the response data of the output variables of the test case.
[0087] Specifically, according to the test sequence, the test case of the first test case set is executed first, and the request data of the test case is stored in the input variable of the test case in the snapshot table, wherein the first test case set is the test case set ranked first in the test sequence.
[0088] After the execution is completed, the response data of the test case is obtained, and the response data is saved in the output variable of the variable set of the first test case set, and pre-stored in the snapshot table, and then the test case of the subsequent test case set is executed. The input variable of the test case of the subsequent test case set is in the variable address of the output variable in the variable set of the previous test case set, and the response data of the output variable corresponding to the input variable of the test case of the subsequent test case set is read to obtain the response data of the output variable of the test case.
[0089] Execute each test case set in sequence, and finally complete the test after executing all the test case sets.
[0090] It should be noted that, according to actual test requirements, the input variables of the test cases in the subsequent test case set can call output variables in the variable set of the previous test case set in the test sequence, or in the input variables saved in the snapshot table.
[0091] Exemplarily, the first test case set is executed first, such as the test case of the user login interface, including test cases such as valid login and invalid login, and the request data of the test case is pre-stored in the relevant input variables in the snapshot table, such as usename_i, password_i, etc. After executing the test case, the response data is obtained and the response data is saved to the output variables, such as status_i, token_i, etc.; then the subsequent test case set is executed, such as the test case of obtaining the financial information interface, including test cases such as verifying the successful acquisition of financial information, verifying invalid users and system anomalies, etc., wherein the input variable of the test case for verifying the successful acquisition of financial information needs to call the response data of the output variable token_i in the variable set of the first test case set, and the data is transferred in different test case sets in the above manner.
[0092] In this embodiment, according to the test order, the test case set of the interface to be tested is traversed and executed by using the test case of the subsequent test case set to call the output variable corresponding to the input variable of the test case of the previous test case set. The test logic is clearer, and no omissions or errors will occur when testing each interface to be tested. The method of calling the corresponding variable address in the output variable set corresponding to the previous test case set avoids the problem of variable loss or overwriting during variable transfer.
[0093] Optional, Figure 4 A schematic diagram of the process of an interface testing method provided in this application Figure 2 , the embodiments of the present application are Figure 2 Based on the embodiment, a step of obtaining a test result by comparing the response data with the expected data and a step of sending the test result to project-related personnel via email are added, such as Figure 4 As shown, the interface testing method provided in this embodiment may specifically include the following steps:
[0094] S401, obtaining multiple test case sets of target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case of the test case set, and different test case sets correspond to different interfaces.
[0095] S402: Determine variable dependency based on the relationship between input variables and output variables in the variable sets of multiple test case sets.
[0096] S403. Execute the test cases of each test case set in accordance with the test order, and when executing the test cases of the subsequent test case set, call the response data of the output variables corresponding to the input variables of the test case in the variable set of the previous test case set based on the variable dependency to obtain the response data of the output variables of the test case.
[0097] S404: Record the response data of the output variables of each executed test case.
[0098] S405: Compare the response data of the output variables of each executed test case with the corresponding expected data to obtain the test result.
[0099] The expected data is pre-stored in the corresponding test cases. After the test case set of each interface is executed, the response data of the output variable needs to be compared with the expected data to verify the correctness of the interface function and obtain the test results, where the test results can include passed test cases, failed test cases and failed test case analysis.
[0100] In some embodiments, after obtaining the test results, a test report can be generated based on a preset format and content, and the test report has a specific format, so that the test report can be sent to project-related personnel via email. The preset format and content may include the number of test cases executed, the passed test cases, and the failed test cases.
[0101] Optionally, the test report may classify and sort the failed test cases according to their severity and priority, and may provide a preliminary treatment plan based on the analysis of the failed test cases.
[0102] S406. Send the test results to project-related personnel via email, where the project-related personnel include developers, testers, and project managers.
[0103] In some embodiments, the test results or test reports may be sent to project related personnel via email.
[0104] In addition to emails, you can also use text messages to send test results or test reports to project-related personnel.
[0105] Through the interface testing method provided in this embodiment, by obtaining the test results and emails, transparent flow and rapid response of key information are achieved, which can improve the efficiency of interface testing.
[0106] Optionally, based on the above embodiment, the interface testing method further includes:
[0107] The test case set is configured as a module and the module is standardized, wherein the module contains several test case sets; if a new test case set is added, the new test case set is configured as a new module, and the variable dependency and test order between the modules are determined; based on the variable dependency, the input variables corresponding to the subsequent module call the output variables of the preceding module to execute the new test case set.
[0108] The new test case set may include a test case set corresponding to the new interface and a new test case set for the original interface of the target software.
[0109] In this step, when the target software is maintained and upgraded, a new test case set may be added. According to the new test case set, the new test case set and the original test case set can be configured as independent modules, and the input variables and output variables of each module are set as global variables. The global variables for communication between modules are standardized to facilitate communication between modules. Among them, the input variables and output variables of the module are variables for communication with external modules or systems.
[0110] Global variables are used to achieve unified management and coordination between modules, and local variables are used within the module to finely control the test case sets corresponding to all interfaces. According to the data transfer between modules, the variable dependency is determined, and new test case sets are executed in sequence.
[0111] For example, Figure 5 This is a schematic diagram of the interface test extension method provided by this application. Figure 5 As shown, there are interface 1 and interface 2 to be tested in the interface test system. The system is now upgraded to add interface 3 and interface 4 to be tested. The test case set and variable set corresponding to interface 1 and interface 2 can be configured as module 1, and the test case set and variable set corresponding to interface 3 and interface 4 can be configured as module 2. The modules interact through variables with variable dependencies between them.
[0112] This interface testing method can be modularized and has high scalability. By configuring the test case set as modules, when adding a new interface to be tested or a new test case for the original test interface, only variables with variable dependencies can be passed between modules, achieving unified management and coordination, facilitating system maintenance and upgrades, and embodying a high degree of modularity and scalability.
[0113] Figure 6 The schematic diagram of the structure of the interface test device provided in this application is as follows: Figure 6 As shown, the interface testing device provided by this embodiment includes: a test case set preparation module 601, a variable dependency determination module 602, a test case calling module 603 and a response data recording module 604.
[0114] The test case set preparation module 601 is used to obtain multiple test case sets of the target software and the variable set of each test case set, wherein the variable set of the test case set includes the variables of each test case in the test case set, and different test case sets correspond to different interfaces; the variable dependency determination module 602 is used to determine the variable dependency based on the relationship between the input variables and the output variables in the variable sets of multiple test case sets; the test case calling module 603 is used to execute the test cases of each test case set in accordance with the test sequence, and when executing the test cases of the subsequent test case set, based on the variable dependency, call the response data of the output variable corresponding to the input variable of the test case in the variable set of the preceding test case set to obtain the response data of the output variable of the test case; the response data recording module 604 is used to record the response data of the output variables of each executed test case.
[0115] Optionally, the variable dependency determination module 602 is specifically configured to:
[0116] Obtain the test requirements of the target software; determine the test order of multiple test case sets based on the test requirements; obtain the correspondence between input variables and output variables in the variable set of each test case set in the multiple test case sets; determine the variable dependency relationship based on the test order and the correspondence relationship, wherein the variable dependency relationship includes the name of the variable, the serial number of the test case corresponding to the output variable called by the variable, and the storage path of the response data of the output variable called by the variable.
[0117] Optionally, the test case calling module 603 is specifically used to:
[0118] In accordance with the test sequence, each test case set is executed to obtain the response data of the output variables of each test case set, and the response data of the output variables of each test case set is pre-stored in the snapshot table. When executing the test cases of the subsequent test case set, based on the variable dependency, the response data of the output variables corresponding to the input variables of the test case are read from the variable address of the variable set of the previous test case set to obtain the response data of the output variables of the test case.
[0119] Optionally, the interface testing device further includes a result verification module 605, which is used to compare the response data of the output variables of each executed test case with the corresponding expected data to obtain the test result.
[0120] Optionally, the interface testing device further includes an email triggering module 606, which is used to send the test results to project-related personnel via email, wherein the project-related personnel include developers, testers and project managers.
[0121] The interface testing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.
[0122] Figure 7 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device 70 provided in this embodiment includes: at least one processor 701 and a memory 702. Optionally, the device 70 further includes a communication component 703. The processor 701, the memory 702 and the communication component 703 are connected via a bus 704.
[0123] In a specific implementation process, at least one processor 701 executes the computer-executable instructions stored in the memory 702, so that at least one processor 701 executes the above method.
[0124] The specific implementation process of the processor 701 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0125] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.
[0126] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.
[0127] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0128] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0129] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.
[0130] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0131] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0132] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0133] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0134] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0135] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0136] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0137] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. An interface testing method, characterized in that: include: Acquire multiple test case sets of the target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case of the test case set, and different test case sets correspond to different interfaces; Determining variable dependencies based on relationships between input variables and output variables in the variable sets of the plurality of test case sets; Execute the test cases of each of the test case sets in accordance with the test order, and when executing the test cases of the subsequent test case set, call the response data of the output variables corresponding to the input variables of the test case in the variable set of the previous test case set based on the variable dependency relationship to obtain the response data of the output variables of the test case; The response data of the output variables of each of the executed test cases are recorded.
2. The method according to claim 1, characterized in that Determining variable dependencies based on relationships between input variables and output variables in the variable sets of the plurality of test case sets includes: Obtaining test requirements for the target software; Based on the test requirements, determining a test order for the multiple test case sets; Obtaining a correspondence between input variables and output variables in a variable set of each of the multiple test case sets; Based on the test sequence and the corresponding relationship, the variable dependency relationship is determined.
3. The method according to claim 2, characterized in that The variable dependency relationship includes the name of the variable, the serial number of the test case corresponding to the output variable called by the variable, and the storage path of the response data of the output variable called by the variable.
4. The method according to claim 1, characterized in that: Executing the test cases of each of the test case sets in accordance with the test order, and when executing the test cases of the subsequent test case set, calling the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set based on the variable dependency relationship to obtain the response data of the output variable of the test case, including: According to the test sequence, each of the test case sets is executed to obtain response data of the output variables of each of the test case sets, and the response data of the output variables of each of the test case sets is pre-stored in a snapshot table; and when executing the test cases of the subsequent test case set, based on the variable dependency, the response data of the output variables corresponding to the input variables of the test case are read to obtain the response data of the output variables of the test case.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The response data of the output variables of each of the executed test cases are compared with the corresponding expected data to obtain the test results.
6. The method according to claim 5, characterized in that After comparing the response data of the output variables of each of the executed test cases with the corresponding expected data to obtain the test results, the method further includes: The test results are sent to project related personnel via email, wherein the project related personnel include developers, testers and project managers.
7. An interface testing device, characterized in that: include: A test case set preparation module, used to obtain multiple test case sets of the target software and a variable set of each test case set, wherein the variable set of the test case set includes variables of each test case of the test case set, and different test case sets correspond to different interfaces; A variable dependency determination module, configured to determine variable dependencies based on the relationship between input variables and output variables in the variable sets of the plurality of test case sets; A test case calling module, used to execute the test cases of each of the test case sets in accordance with the test order, and when executing the test cases of the subsequent test case set, based on the variable dependency, call the response data of the output variable corresponding to the input variable of the test case in the variable set of the previous test case set to obtain the response data of the output variable of the test case; The response data recording module is used to record the response data of the output variables of each of the executed test cases.
8. An electronic device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.