Test case processing method, device, computer equipment and storage medium
By automatically generating test cases and analyzing response messages, it solves the problems of low testing efficiency and poor accuracy in software development, and achieves more efficient and accurate test case generation and result evaluation.
Patent Information
- Application Number
- CN202410544946.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-06
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-05-06
AI Technical Summary
In software development, the testing efficiency of system interfaces is low and the results are inaccurate. This is mainly due to the low efficiency of manually written test cases and insufficient coverage conditions, which affects the accuracy of test results and the efficiency of regression testing.
By determining the value information, including normal values, abnormal values and boundary values, based on the parameter configuration information and type of the interface request parameters, generating full and single parameter test cases, using a numerical generator to automatically and randomly generate test values to improve the coverage of test cases and quantity, combine test types to generate test requests and analyze response messages to evaluate interface robustness.
It improves the efficiency and accuracy of test case generation, increases the coverage of test cases, automates test case writing and result classification, reduces manual intervention, and improves the reliability of test results and regression testing efficiency.
Smart Images

Figure CN118132448B
Abstract
Description
Technical Field
[0001] The present application relates to the field of software development technology, and in particular to a test case processing method, apparatus, computer equipment and storage medium. Background Art
[0002] Software development is a systematic project. The software development process includes development, testing, launch, and operation. Whether it is waterfall development mode, agile development mode or other development mode, the process from development to testing is basically the same. Starting from the requirements review, developers and testers will focus on business code implementation and use case test writing respectively.
[0003] In the process of software development and testing, testing the system interface is a relatively complex task that requires manual writing of test cases. When writing test cases manually, it is only a simple configuration of the test values of some interface request parameters to write test cases. In addition, due to the low efficiency of manual writing of test cases, the number of test cases that can be written is very limited. Therefore, the use of manual writing of test cases not only affects the test efficiency, but also affects the accuracy of the test results. Summary of the invention
[0004] Based on this, it is necessary to provide a test case processing method, device, computer equipment and storage medium that can improve test case generation efficiency and test accuracy in response to the above technical problems.
[0005] In a first aspect, the present application provides a test case processing method, the method comprising:
[0006] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0007] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0008] In one of the embodiments, the parameter configuration information includes parameter boundary information and parameter rule information;
[0009] Accordingly, according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, including:
[0010] Determine the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter;
[0011] According to the parameter rule information and parameter type of the interface request parameter, normal value information and abnormal value information of the interface request parameter are determined.
[0012] In one of the embodiments, the number of interface request parameters is at least two, and the value information includes normal value information and abnormal value information;
[0013] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0014] If the test type is a full test, the value generator is called to generate the normal test value and abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter;
[0015] According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
[0016] In one of the embodiments, the number of interface request parameters is at least two, and the value information further includes null value information;
[0017] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0018] If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter;
[0019] According to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0020] In one embodiment, according to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0021] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0022] For each target parameter, when the value information of other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0023] In one embodiment, according to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0024] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0025] For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
[0026] In one embodiment, the method further comprises:
[0027] Generate test requests based on test cases;
[0028] Sending a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request;
[0029] Determine the test result of the interface to be tested based on the status code information in the request response message.
[0030] In one embodiment, the status code information includes error code information; the error code information includes an error code type and an error code severity level;
[0031] Accordingly, the test result of the interface to be tested is determined according to the status code information in the request response message, including:
[0032] Classify the request response results according to the error code type in the request response message;
[0033] Determine the robustness evaluation result of the interface to be tested based on the classification results and the severity level of the error code;
[0034] According to the robustness evaluation results, the test results of the interface to be tested are determined.
[0035] In one embodiment, the number of interfaces to be tested is at least two, and the method further includes:
[0036] Arrange the interfaces to be tested according to the test scenarios;
[0037] Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0038] In a second aspect, the present application provides a test case processing method, the device comprising:
[0039] The first determination module is used to determine the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is the value information that does not contain the boundary value;
[0040] The first generation module is used to generate a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter; wherein the test type includes a full test and a single parameter test.
[0041] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0042] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0043] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0044] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0045] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0046] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0047] In a fifth aspect, the present application further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0048] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0049] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0050] The above-mentioned test case processing method, device, computer equipment and storage medium, the present application determines the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, and the value information includes at least two of normal value information, abnormal value information and boundary value information. According to the test type of the interface to be tested (the test type includes full test and single parameter test) and the value information of the interface request parameter, the test case of the interface to be tested is automatically generated. Compared with the traditional manually written test case, the present application considers the value information of each interface request parameter, and when determining the value information, the parameter type is also considered, so that the coverage of the determined value information is wider. When generating test cases, not only the value information of the interface request parameter is considered, but also the test type of the interface to be tested is considered, so that the number of test cases automatically generated in the end is more and the coverage is more comprehensive. Therefore, the test case generation method of the present application is not only more intelligent, but also can automatically generate test cases, and the number of generated test cases is more and the coverage is wider, which not only improves the generation efficiency of test cases, but also makes the test results more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 An application environment diagram of a test case processing method provided in this embodiment;
[0052] Figure 2 A flowchart of the first test case processing method provided in this embodiment;
[0053] Figure 3 A schematic diagram of the process of generating a full set of test cases provided in this embodiment;
[0054] Figure 4 A schematic diagram of the process of generating a single test case provided in this embodiment;
[0055] Figure 5 A flowchart of a second test case processing method provided in this embodiment;
[0056] Figure 6 A flowchart of a third test case processing method provided in this embodiment;
[0057] Figure 7 A flowchart of a fourth test case processing method provided in this embodiment;
[0058] Figure 8A structural block diagram of a test case processing device provided in this embodiment;
[0059] Fig. 9 This is a diagram of the internal structure of the computer device provided in this embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] The traditional way of writing test cases has the following defects: 1. Existing test cases are usually written manually, and the test cases are written according to the interface request address, interface request method, and interface request parameters to be tested. Since the types and quantities of interface request parameters may include multiple, and basically each interface request parameter includes normal constants and abnormal parameters, the manual configuration of interface request parameters is very labor-intensive, resulting in low efficiency in manually writing test cases. 2. The traditional method of manually writing test cases also has the problem of insufficient coverage conditions. Most of the time, there are multiple types and quantities of interface request parameters. If different scenario conditions are to be covered for each interface request parameter, a lot of effort is required. Generally, several parameters are randomly selected for each interface request parameter to generate test cases, resulting in insufficient coverage conditions for the test cases. 3. In the actual testing process of test cases, exceptions are often tested, some of which are caused by data and some by code quality. In order to better record the test situation, find the source of the exception, and solve related problems, it is generally necessary to manually record and classify the test results. Not only the abnormal results need to be classified, but also the test cases that cause the abnormal results need to be classified. Therefore, the current classification method not only affects the classification efficiency, but also the regression test efficiency. 4. The current testing method basically only uses a fixed process to test an interface. It cannot be combined with actual business scenarios for interface testing and cannot test potential problems of the target system.
[0062] Testers usually submit bugs manually and assign them to designated developers. After the relevant developers have completed the processing, they will return to the verification test. In the first round of testing, many problems are often tested. During the entire testing process, the problems need to be collected and classified one by one. In this process, the manual recording and classification of normal / abnormal / bug related test results is a repetitive manual processing and recording.
[0063] In the subsequent continuous iterative testing, the number of problem items will gradually decrease. In the regression test, the problems that occurred before need regression testing, and the normal problems before also need to be tested again. The testing process is highly repetitive. Because the testing tools used, such as Postman, and the problem recording tools, such as ZenTao, are generally isolated, the overall traceability of the bug life cycle is not high, including the occurrence time, frequency, and subsequent iteration repair rate, which is not very helpful for the subsequent review and summary of the test problems.
[0064] The test case processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The test system 102 determines the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested of the target system 104. And generates a test case of the interface to be tested of the target system 104 according to the test type of the interface to be tested and the value information of the interface request parameter. The value information includes at least two of normal value information, abnormal value information and boundary value information, and the test type includes full test and single parameter test.
[0065] The test system refers to the system that tests the interface to be tested. The test system can be a test device or a server. The test device can be a terminal device, such as a powerful computer. The server can be an independent server or a server cluster. The test system can generate test cases.
[0066] The target system refers to the system that needs to be interface tested. It can be a software system or a system that combines software and hardware.
[0067] In one embodiment, Figure 2 is a flow chart of a test case processing method provided in accordance with an embodiment of the present application, in which the method is applied to Figure 1 Taking the test system in as an example, the method includes the following steps:
[0068] S201, determining value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested, wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is the value information that does not contain the boundary value.
[0069] Among them, the interface to be tested refers to the interface with test requirements. The interface request parameters refer to the interface request parameters in the interface to be tested. The interface generally includes the interface request method, the interface request address and the interface request parameters. The interface request method generally refers to the operation method of the resource, mainly including adding, deleting, querying, modifying, etc. The interface request address generally includes fixed and dynamically changing ones, and the dynamic one generally contains business data; fixed addresses such as: / admin / gateway-devices; dynamic addresses such as / admin / gateway-device / {vin}, which contains the dynamic parameter chassis number vin that needs to be transmitted. The interface request address refers to the resource access address. Parameter configuration information refers to the relevant configuration information of the interface request parameters, mainly including the parameter boundary information and parameter rule information of the interface request parameters. Parameter type refers to the type of each interface request parameter, generally including numeric type (for example, 1, 2, 3, etc.), string type (for example, "abc", "123@qq.com", etc.), bool type (for example, true, false, etc.), time type (for example, "2024-02-17T08:30:00Z", etc.). Value information refers to the range of values available for each interface request parameter. Normal value information refers to the parameter value information that meets the requirements of the defined interface request parameter. Boundary value information refers to the boundary value or critical value of the interface request parameter. Abnormal value information refers to the parameter value information that does not comply with the interface request parameter configuration rules. It should be noted that value information also includes null value information, which means that the parameter value of the interface request parameter is null.
[0070] An optional implementation of this embodiment is: according to the parameter boundary information of the interface request parameter, the boundary value information of the interface request parameter is determined. According to the parameter rule information and parameter type of the interface request parameter, the normal value information and abnormal value information of the interface request parameter are determined. Exemplarily, assuming that a certain interface request parameter is age information, and the value range of the age information is 0-100, then the parameter boundary information of the interface request parameter is 0 and 100, and the corresponding boundary value information is 0 and 100. The parameter rule information of the interface request parameter is 0-100, and the parameter type is a numeric type, then the normal value information of the interface request parameter is 0-100, and the abnormal value information is less than 0 and greater than 100. In other words, numerical parameters and time parameters generally have boundary value information, normal value information and abnormal value information. Boundary value information is generally a specific value, and normal value information and abnormal value information are generally range values. Bool type parameters and string type parameters may only have normal value information and abnormal value information, and no boundary value information.
[0071] Another optional implementation of this embodiment is: inputting parameter configuration information and parameter type of the interface request parameter of the interface to be tested into a value acquisition tool, and the value acquisition tool determines the value information of the interface request parameter. The value acquisition tool may be, but is not limited to, a trained neural network model.
[0072] Optionally, in this embodiment, parameter configuration information of the interface to be tested may be obtained by parsing the interface template of the interface to be tested.
[0073] S202: Generate a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter, wherein the test type includes a full test and a single parameter test.
[0074] Among them, the test case refers to the test document used to perform performance testing on the interface to be tested. The test case generally includes the interface request address, interface request method and interface request parameters. The test type refers to the type of test on the interface to be tested based on the test case, which mainly includes full test and single parameter test. The full test refers to the test on the interface to be tested based on the full normal test case and the full abnormal test case. The full normal test case refers to the test case in which all interface request parameters in the test case are normal values. The full abnormal test case refers to the test case in which all interface request parameters in the test case are abnormal values. The single parameter test refers to the test on the interface to be tested using a single test case. The single test case refers to the test case generated by transforming the value information of only one interface request parameter among all the interface request parameters in the test case.
[0075] An optional implementation of this embodiment is: determining the parameter value of the interface request parameter according to the test type of the interface to be tested and the value information of the interface request parameter, and generating a test case for the interface to be tested according to the parameter value of the interface request parameter.
[0076] Another optional implementation of this embodiment is: input the test type of the interface to be tested and the value information of the interface request parameter into a test case generation tool, and the test case generation tool generates a test case that meets the test type of the interface to be tested and the value information requirements of the interface request parameter. The test case generation tool adopts but is not limited to a neural network model.
[0077] Optionally, in this embodiment, an interface set can be created according to project requirements. Among them, the interface to be tested is the interface in the interface set. For the interfaces in the interface set, you can add interfaces manually, or you can generate interfaces by parsing interface documents and development tools swagger. For example, for a user management system, you can create an interface set with functions such as adding, deleting, modifying, and querying according to management requirements. After the interface set is created, the interfaces in the interface set can be viewed through the UI (User Interface) interface, and the interface-related parameters of each interface can be configured.
[0078] The above-mentioned test case processing method determines the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, and the value information includes at least two of normal value information, abnormal value information and boundary value information. According to the test type of the interface to be tested (the test type includes full test and single parameter test) and the value information of the interface request parameter, the test case of the interface to be tested is automatically generated. Compared with the traditional manually written test case, the present application considers the value information of each interface request parameter, and when determining the value information, the parameter type is also considered, so that the coverage of the determined value information is wider. When generating test cases, not only the value information of the interface request parameter is considered, but also the test type of the interface to be tested is considered, so that the number of test cases automatically generated in the end is more and the coverage is more comprehensive. Therefore, the test case generation method of the present application is not only more intelligent, but also can automatically generate test cases, and the number of generated test cases is more and the coverage is wider, which not only improves the generation efficiency of test cases, but also makes the test results more accurate.
[0079] In one embodiment, the number of interface request parameters is more than two, and the value information includes at least normal value information and abnormal value information. In this case, in order to obtain more comprehensive coverage of full normal test cases and full abnormal test cases, such as Figure 3 As shown, an optional implementation of S202 includes:
[0080] S301, if the test type is a full test, call a value generator to generate a normal test value and an abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter.
[0081] Among them, the value generator refers to a generating tool that can automatically and randomly generate the required value according to the set conditions. In this application, the value generator is mainly used to automatically and randomly generate test values. The value generator mainly includes a numerical generator, a bool generator, a time generator, and a string generator, etc., which are used to generate different types of values or characters. The normal test value refers to the value generated by the value generator according to the normal value information. For example, if the normal value information is a range value of 0-100, that is, a value between 0-100 is a normal value, and the value generator is based on the range of 0-100. The randomly generated value (for example, 50) is the normal test value. The abnormal test value refers to the value generated by the value generator according to the abnormal value information. For example, if the abnormal value information is a range value less than 0 or greater than 100, that is, a value less than 0 or greater than 100 is an abnormal value, and the value generator is based on the range of less than 0 or greater than 100. The value (for example, 110) is the abnormal test value.
[0082] Optionally, in this embodiment, a numerical value generator is called to generate a normal test value of each interface request parameter according to the normal value information of each interface request parameter. A numerical value generator is called to generate an abnormal test value of each interface request parameter according to the abnormal value information of each interface request parameter. Specifically, a numerical value generator is called to randomly generate a normal test value of each interface request parameter according to the normal value information of each interface request parameter. A numerical value generator is called to randomly generate an abnormal test value of each interface request parameter according to the abnormal value information of each interface request parameter.
[0083] Exemplarily, taking the user information adding interface as an example, it is assumed that the interface request parameters of the user information adding interface include user name, age and home address, wherein the normal value information of the length of the user name is 2-10. The normal value information of the age is 1-100. The normal value information of the character length of the home address is 3-32. By calling the value generator, according to the normal value information of the user name, age and home address, the normal test value of the interface request parameter corresponding to the user name, age and home address can be randomly generated. Similarly, by calling the value generator, according to the abnormal value information of the user name, age and home address, the abnormal test value of the interface request parameter corresponding to the user name, age and home address can be randomly generated.
[0084] S302, generating a full amount of normal test cases for the interface to be tested according to the normal test value of each interface request parameter, and generating a full amount of abnormal test cases for the interface to be tested according to the abnormal test value of each interface request parameter.
[0085] Optionally, in this embodiment, according to the normal test value of each interface request parameter, the interface request address and the interface request parameter, a full amount of normal test cases of the interface to be tested is automatically generated. According to the abnormal test value of each interface request parameter, the interface request address and the interface request parameter, a full amount of abnormal test cases of the interface to be tested is automatically generated.
[0086] In this embodiment, when the test type is a full test, a value generator can be called to automatically generate normal test values and abnormal test values of each interface request parameter based on the normal value information and abnormal value information of each interface request parameter; and a full normal test case of the interface to be tested is generated based on the normal test value of each interface request parameter, and a full abnormal test case of the interface to be tested is generated based on the abnormal test value of each interface request parameter. In this embodiment, the normal value information and abnormal value information of each interface request parameter can be automatically and randomly generated by calling the value generator, and a full normal test case and a full abnormal test case are automatically generated. Compared with manually written test cases, the present application takes the test type into consideration. When the test type is a full test, a full normal test case and a full abnormal test case with more comprehensive coverage can be automatically generated, which not only increases the efficiency of test case writing, but also has a wider coverage and more reliable test results.
[0087] In one embodiment, the number of interface request parameters is more than two, and the value information includes null value information. In this case, in order to obtain a more comprehensive single-volume test case, such as Figure 4 As shown, an optional implementation of S202 includes:
[0088] S401: If the test type is a single parameter test, a parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter.
[0089] Among them, the null value information means that the parameter value of the interface request parameter is a null value. Parameter priority refers to the priority of each interface request parameter. The parameter priority of each interface request parameter can be set manually, or the order of the interface request parameters can be used as the priority order of each interface request parameter. For example, the earlier the interface request parameter is, the higher the parameter priority level is. Parameter test order refers to the test order of each interface request parameter of the interface to be tested.
[0090] Optionally, in this embodiment, each interface request parameter is sorted according to its parameter priority to obtain a priority order, and the priority order of each interface request parameter is used as a parameter test order of each interface request parameter.
[0091] Exemplarily, taking the user information adding interface as an example, assuming that the interface request parameters of the user information adding interface include user name, age, home address, etc. The parameter priority of the user name is the highest, followed by the home address, and finally the age. Then the priority order of the interface request parameters of the user information adding interface is user name, home address, and age. When the test type is a single parameter test, this priority order is used as the parameter test order of each interface request parameter of the user information adding interface.
[0092] S402, transform the value information of each interface request parameter in turn according to the parameter test sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0093] An optional implementation of this embodiment is: according to the parameter test order, each interface request parameter is used as the target parameter in turn. For each target parameter, when the value information of the other interface request parameters is normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0094] Exemplarily, taking the user information adding interface as an example, the parameter test order of the interface request parameters of the user information adding interface is user name, home address and age. According to the parameter test order, the control variable method is adopted. First, the user name is used as the target parameter. When the user name is used as the target parameter, the value information of the home address and age are both normal value information, that is, the parameter test values of the home address and age are randomly generated by calling the value generator. The user name value information is transformed in turn. It can be transformed into null value information, abnormal value information, and boundary value information, and finally transformed into normal value information. Through the value generator, different test values are generated according to the value information. That is to say, when the value information of the user name is null value information, and the value information of the home address and age are normal value information, some test cases are generated; in the case of the user name When the value information is abnormal value information and the value information of home address and age is normal value information, some test cases are generated; when the value information of user name is boundary value information and the value information of home address and age is normal value information, some test cases are generated, and finally the value information of user name is transformed into normal value information, and the home address is used as the target parameter. And so on, according to the parameter test order, each interface request parameter is used as the target parameter in turn, and when the value information of other interface request parameters is normal value information, the value information of the target parameter is transformed in turn to obtain the corresponding test case, and all the test cases obtained above are used as single test cases.
[0095] Another optional implementation of this embodiment is: according to the parameter test order, each interface request parameter is used as the target parameter in turn. For each target parameter, when the value information of the interface request parameter with a higher priority than the parameter is normal value information, and the value information of the interface request parameter with a lower priority than the parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0096] Exemplarily, taking the user information adding interface as an example, the parameter test order of the interface request parameters of the user information adding interface is user name, home address and age. According to the parameter test order, the control variable method is adopted, and the user name is first used as the target parameter. When the user name is used as the target parameter, since the parameter priority of the home address and age is lower than that of the user name, the value information of the home address and age are both null value information. In this case, the value information of the user name is transformed between abnormal value information and boundary value information, and in the transformation process, the corresponding abnormal test value and boundary test value are generated by calling the value generator, and combined with the normal test values randomly generated for the interface request parameters such as home address and age in this process, the corresponding test case is obtained. That is to say, when the value information of the user name is abnormal value information, and the value information of the home address and age is normal value information, some test cases are generated; when the value information of the user name is null value information, and the value information of the home address and age is normal value information, some test cases are generated, and finally the value information of the user name is transformed into normal value information, and the home address is used as the target parameter. In this case, since the parameter priority of age is lower than that of the home address, the value information of age is null value information. And so on, according to the parameter testing order, each interface request parameter is used as the target parameter in turn, and when the value information of the interface request parameter with a higher priority than the target parameter is normal value information, and the value information of the interface request parameter with a lower priority than the target parameter is null value information, the value information of the target parameter is transformed in turn to obtain the corresponding target parameter test case, and all the test cases obtained above are used as single quantity test cases.
[0097] Another optional implementation of this embodiment is: according to the parameter test sequence, each interface request parameter is used as the target parameter in turn. For each target parameter, when the value information of the other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain the first test case of the target parameter. According to the parameter test sequence, each interface request parameter is used as the target parameter in turn. For each target parameter, when the value information of the interface request parameter with a higher priority than the target parameter is normal value information, and the value information of the interface request parameter with a lower priority than the target parameter is null value information, the value information of the target parameter is transformed in turn to obtain the second test case of the target parameter. Both the first test case and the second test case are used as single test cases.
[0098] In this embodiment, when the test type is a single parameter test, the present application first determines the parameter test order of each interface request parameter according to the parameter priority of each interface request parameter. Then, according to the parameter test order, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested. The single quantity test case obtained based on this embodiment covers the test cases of each interface request parameter under normal, abnormal, boundary, and null value conditions, and can be tested for each interface request parameter to increase the accuracy of the test results.
[0099] In one embodiment, in order to more accurately determine the test results, such as Figure 5 As shown, an optional implementation of a test case processing method includes:
[0100] S501, generating a test request according to the test case.
[0101] The test request refers to a request access instruction initiated based on a test case.
[0102] Optionally, in this embodiment, a request format of a test request is obtained, and based on a test case, a request content corresponding to the request format is determined to obtain a test request.
[0103] S502: Send a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request.
[0104] The request response message refers to the response message fed back to the test system after the interface to be tested receives the test request.
[0105] Optionally, in this embodiment, a test request is sent to the interface to be tested, and after the interface to be tested receives the request instruction, it feeds back a request response message according to the request content in the test request.
[0106] S503: Determine the test result of the interface to be tested according to the status code information in the request response message.
[0107] Among them, the status code information refers to the indicator code information used to indicate whether the response content of the request response message is a normal response content or an abnormal response content, including but not limited to the error code type, such as TSP_10001 indicating that the data cannot be empty), TSP_10002 indicating that the data is not in the valid range, TSP_10003 indicating that the business data does not exist, TSP_10004 indicating an internal system exception, etc. Each error code type has a corresponding error code severity level, which is used to characterize the error severity of different error code types.
[0108] An optional implementation of this embodiment is: the status code information includes error code information; the error code information includes the error code type and the error code severity level.
[0109] An optional implementation method for determining the test result of the interface to be tested based on the status code information in the request response message is: classify the request response result according to the error code type in the request response message. Determine the robustness evaluation result of the interface to be tested based on the classification result and the error code severity level. Determine the test result of the interface to be tested based on the robustness evaluation result. An optional implementation method for determining the robustness evaluation result of the interface to be tested based on the classification result and the error code severity level is: obtain the number of request response messages corresponding to different error code types, determine the weight value corresponding to each error code type based on the error code severity level corresponding to each error code type, perform weighted summation processing based on the initial score, weight value and corresponding number of messages corresponding to each error code type, obtain the robustness score of the interface to be tested, and use the robustness score as the robustness evaluation result of the interface to be tested. In this embodiment, an optional implementation method for determining the test result of the interface to be tested based on the robustness evaluation result is: use the robustness evaluation result as the test result of the interface to be tested. In this embodiment, another optional implementation method for determining the test results of the interface to be tested based on the robustness evaluation results is: a comprehensive evaluation can be performed based on the robustness evaluation results and other evaluation results (for example, accuracy, timeliness, etc.) to obtain a comprehensive evaluation result, and the comprehensive evaluation result is recorded as the test result of the interface to be tested.
[0110] In this embodiment, after obtaining the request response message, the request response message can be automatically classified according to the error code information in the request response message. Compared with the traditional manual recording and classification method, the automatic classification method adopted by this application greatly improves the classification efficiency. In addition, this embodiment can also determine the robustness evaluation result of the interface to be tested based on the classification result and the severity level of the error code. The traditional manual classification method can only roughly judge the robustness of the interface to be tested through manual experience, and does not have a high reference value. The robustness evaluation method in this embodiment can accurately reflect the robustness of the interface to be tested, and can help the staff to clarify whether the interface to be tested meets expectations and the repair effect.
[0111] Another optional implementation of this embodiment is: the status code information includes error code information and normal code information, and the error code information includes the error code type and the error code severity level corresponding to each error code type. Obtain the number of normal messages of the request response message with normal code information, and obtain a first test score based on the number of normal messages and the corresponding message scores. Obtain the number of request response messages corresponding to different error code types, determine the weight value corresponding to each error code type based on the error code severity level corresponding to each error code type, perform weighted summation processing based on the initial score, weight value and corresponding number of messages corresponding to each error code type, and obtain a second test score. Determine the total test score based on the first test score and the second test score, and the total test score can be used as the test result of the interface to be tested.
[0112] Optionally, in this embodiment, each request response message and the test case corresponding to the request response message can be classified and stored according to the error code type, which is convenient for subsequent access and query according to the error code type for subsequent code quality analysis and projects.
[0113] In this embodiment, a test request is generated according to the test case. A test request is sent to the interface to be tested, so that the interface to be tested can feedback a request response message based on the test request. The test result of the interface to be tested is determined according to the status code information in the request response message. The present application can determine the overall test situation based on the test results and accurately understand the interface performance of the interface to be tested. And based on the test results, the system robustness of the system to be tested (i.e., the target system) can be evaluated, which is helpful for the development and iterative upgrade of the target system.
[0114] In one embodiment, in order to make the test more in line with the actual application scenario, such as Figure 6 As shown, an optional implementation of a test case processing method includes:
[0115] S601, arrange the interfaces to be tested according to the test scenario.
[0116] The test scenario refers to simulating various situations and operations that users encounter during actual use from the user's perspective. The interface test sequence refers to the interface usage sequence obtained by simulating the user's usage sequence.
[0117] An optional implementation of this embodiment is: according to the test scenario, determine the interface access process under the test scenario, determine the interface test sequence according to the interface access process, and arrange the interfaces to be tested according to the interface test sequence.
[0118] Another optional implementation of this embodiment is: according to the test scenario, determine the candidate interfaces, randomly select the interfaces to be tested from the candidate interfaces, and arrange the interfaces to be tested.
[0119] S602: Test each interface to be tested according to the test frequency and test duration of each interface to be tested and the test case of each interface to be tested.
[0120] The test frequency refers to the test frequency for each interface to be tested, for example, how many times a test is required in one minute. The test duration refers to the overall duration of the test in this test scenario, for example, 10 minutes, 30 minutes, etc.
[0121] Optionally, in this embodiment, the interface test sequence between the interfaces to be tested is first determined according to the test scenario, and the test cases corresponding to the interfaces to be tested are obtained. According to the interface test sequence, test frequency and test duration between the interfaces to be tested, the test cases corresponding to the interfaces to be tested are called to test the interfaces to be tested.
[0122] Optionally, in this embodiment, interfaces to be tested may be randomly selected according to the test scenario, and test cases corresponding to each interface to be tested may be obtained. Each interface to be tested may be tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0123] Optionally, in this embodiment, according to the interface to be tested and the test scenario, a test case that meets the requirements (for example, a test case in which all request parameters are normal) can be obtained from all test cases corresponding to the interface to be tested. Corresponding test cases can also be generated according to each interface to be tested, wherein the method for generating test cases is described in detail in the above embodiment and will not be repeated here.
[0124] In this embodiment, when testing, the test scenario is also considered, and the interface test order between the interfaces to be tested is determined according to the test scenario. According to the interface test order, test frequency and test duration between the interfaces to be tested, as well as the test cases of each interface to be tested, each interface to be tested is tested. Testing in combination with the test scenario can simulate the interface usage scenarios of business intersection and data intersection in actual use, and can expose some problems that cannot be measured by a single interface, such as the problem of locking the table when modifying and adding at the same time, and the problem of dirty data when deleting and querying at the same time, which not only increases the concurrency, but also can perform certain stress tests on the target system.
[0125] In one embodiment, if Figure 7 As shown, another optional implementation of the test case testing method includes:
[0126] S701, determining boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter.
[0127] S702: Determine normal value information and abnormal value information of the interface request parameter according to parameter rule information and parameter type of the interface request parameter.
[0128] S703: The boundary value information, normal value information, null value information and abnormal value information of the interface request parameter are all used as the value information of the interface request parameter. Then, S704 or S706 is executed.
[0129] Among them, the normal value information is the value information that does not contain the boundary value.
[0130] S704, if the test type is a full test, call a value generator to generate a normal test value and an abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter.
[0131] S705: Generate all normal test cases of the interface to be tested according to the normal test value of each interface request parameter, and generate all abnormal test cases of the interface to be tested according to the abnormal test value of each interface request parameter. Then execute S7010.
[0132] S706: If the test type is a single parameter test, determine the parameter test order of each interface request parameter according to the parameter priority of each interface request parameter.
[0133] S707, according to the parameter test sequence, each interface request parameter is used as the target parameter in turn, and then S708 or S709 is executed.
[0134] S708, for each target parameter, when the value information of other interface request parameters are all normal value information, transform the value information of the target parameter in turn to obtain a single quantity test case of the target parameter. Then execute S7010.
[0135] S709: For each target parameter, when the value information of the interface request parameter with a higher priority than the parameter is normal value information and the value information of the interface request parameter with a lower priority than the parameter is null value information, transform the value information of the target parameter in turn to obtain a single quantity test case of the target parameter. Then execute S7010.
[0136] S7010: Generate a test request based on the test case.
[0137] The test cases here include all normal test cases, all abnormal test cases, and single test cases corresponding to each interface request parameter.
[0138] S7011, sending a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request;
[0139] S7012, classify the request response results according to the error code type in the request response message.
[0140] S7013: Determine the robustness evaluation result of the interface to be tested according to the classification result and the error code severity level.
[0141] S7014: Determine the test result of the interface to be tested according to the robustness evaluation result.
[0142] This embodiment also includes a test case processing method combined with a test scenario, and the specific steps are as follows:
[0143] Arrange the interfaces to be tested according to the test scenario.
[0144] Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0145] The test method for the interface to be tested in this embodiment includes the following three stages:
[0146] In the first stage, the interface to be tested is tested based on all normal test cases;
[0147] In the second stage, the interface to be tested is first tested based on the full amount of normal test cases, and then tested based on the single amount of test cases.
[0148] In the third stage, the interface to be tested is first tested based on a full set of abnormal test cases, and then tested based on a full set of normal test cases.
[0149] The test case processing method of this embodiment determines the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, and the value information includes at least two of normal value information, abnormal value information and boundary value information. According to the test type of the interface to be tested (the test type includes full test and single parameter test) and the value information of the interface request parameter, the test case of the interface to be tested is automatically generated. Compared with the traditional manually written test case, the present application considers the value information of each interface request parameter, and when determining the value information, the parameter type is also considered, so that the coverage of the determined value information is wider. When generating the test case, not only the value information of the interface request parameter is considered, but also the test type of the interface to be tested is considered, so that the number of test cases automatically generated in the end is more and the coverage is more comprehensive. Therefore, the test case generation method of the present application is not only more intelligent, but also can automatically generate test cases, and the number of generated test cases is more and the coverage is wider, which not only improves the generation efficiency of the test case, but also makes the test results more accurate.
[0150] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0151] Based on the same inventive concept, the embodiment of the present application also provides a test case processing device for implementing the test case processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more test case processing device embodiments provided below can refer to the limitations of the test case processing method above, and will not be repeated here.
[0152] In one embodiment, by Figure 8 FIG. 2 shows a structural block diagram of a test case processing device in an embodiment. Figure 8As shown, a test case processing device 800 is provided, the device comprising: a first determination module 801 and a first generation module 802, wherein:
[0153] The first determination module 801 is used to determine the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the parameter configuration information includes parameter boundary information and parameter rule information; the number of interface request parameters is at least two; and the normal value information is the value information that does not include the boundary value.
[0154] The first generating module 802 is used to generate a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter; wherein the test type includes a full test and a single parameter test.
[0155] In one embodiment, the Figure 8 The first determining module 801 in the embodiment is further specifically configured to:
[0156] Determine the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter;
[0157] According to the parameter rule information and parameter type of the interface request parameter, normal value information and abnormal value information of the interface request parameter are determined.
[0158] In one embodiment, the Figure 8 The first generation module 802 in the embodiment is further specifically used for:
[0159] If the test type is a full test, the value generator is called to generate the normal test value and abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter;
[0160] According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
[0161] In one embodiment, the Figure 8 The first generation module 802 in the embodiment is further specifically used for:
[0162] If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter;
[0163] According to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0164] In one embodiment, the Figure 8 The first generation module 802 in the embodiment is further specifically used for:
[0165] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0166] For each target parameter, when the value information of other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0167] In one embodiment, the Figure 8 The first generation module 802 in the embodiment is further specifically used for:
[0168] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0169] For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
[0170] In one embodiment, the Figure 8 The test case processing device 800 further includes:
[0171] The second generation module is used to generate a test request according to the test case;
[0172] A sending module, used for sending a test request to the interface to be tested, so that the interface to be tested can feed back a request response message based on the test request;
[0173] The second determination module is used to determine the test result of the interface to be tested according to the status code information in the request response message.
[0174] In one embodiment, the status code information includes error code information; the error code information includes the error code type and the error code severity level; on this basis, the second determination module is further specifically used to:
[0175] Classify the request response results according to the error code type in the request response message;
[0176] Determine the robustness evaluation result of the interface to be tested based on the classification results and the severity level of the error code;
[0177] Based on the robustness evaluation results, the test results of the interface to be tested.
[0178] In one embodiment, the Figure 8 The test case processing device 800 further includes:
[0179] The third determination module is used to arrange the interfaces to be tested according to the test scenario;
[0180] The test module is used to test each interface to be tested according to the test frequency and test duration of each interface to be tested and the test cases of each interface to be tested.
[0181] Each module in the above test case processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0182] In one embodiment, a computer device is provided. The computer device may be a platform side, and its internal structure diagram may be as shown in FIG. Fig. 9 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store registration and authentication information. The network interface of the computer device is used to communicate with an external user side through a network connection. When the computer program is executed by the processor, a test case processing method is implemented.
[0183] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. Specifically, the computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0184] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0185] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0186] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0187] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the parameter configuration information includes parameter boundary information and parameter rule information;
[0188] Accordingly, according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, including:
[0189] Determine the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter;
[0190] According to the parameter rule information and parameter type of the interface request parameter, normal value information and abnormal value information of the interface request parameter are determined.
[0191] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the number of interface request parameters is at least two, and the value information includes normal value information and abnormal value information;
[0192] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0193] If the test type is a full test, the value generator is called to generate the normal test value and abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter;
[0194] According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
[0195] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the number of interface request parameters is at least two, and the value information also includes null value information;
[0196] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0197] If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter;
[0198] According to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0199] In one embodiment, when the processor executes the computer program, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0200] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0201] For each target parameter, when the value information of other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0202] In one embodiment, when the processor executes the computer program, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0203] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0204] For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
[0205] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0206] Generate test requests based on test cases;
[0207] Sending a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request;
[0208] Determine the test result of the interface to be tested based on the status code information in the request response message.
[0209] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the status code information includes error code information; the error code information includes an error code type and an error code severity level;
[0210] Accordingly, the test result of the interface to be tested is determined according to the status code information in the request response message, including:
[0211] Classify the request response results according to the error code type in the request response message;
[0212] Determine the robustness evaluation result of the interface to be tested based on the classification results and the severity level of the error code;
[0213] According to the robustness evaluation results, the test results of the interface to be tested are determined.
[0214] In one embodiment, when the processor executes the computer program, the following steps are further implemented: the number of interfaces to be tested is at least two, and the method further includes:
[0215] Arrange the interfaces to be tested according to the test scenarios;
[0216] Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0217] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0218] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0219] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0220] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the parameter configuration information includes parameter boundary information and parameter rule information;
[0221] Accordingly, according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, including:
[0222] Determine the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter;
[0223] According to the parameter rule information and parameter type of the interface request parameter, normal value information and abnormal value information of the interface request parameter are determined.
[0224] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the number of interface request parameters is at least two, and the value information includes normal value information and abnormal value information;
[0225] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0226] If the test type is a full test, the value generator is called to generate the normal test value and abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter;
[0227] According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: the number of interface request parameters is at least two, and the value information further includes null value information;
[0229] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0230] If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter;
[0231] According to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0232] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0233] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0234] For each target parameter, when the value information of other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0235] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0236] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0237] For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
[0238] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0239] Generate test requests based on test cases;
[0240] Sending a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request;
[0241] Determine the test result of the interface to be tested based on the status code information in the request response message.
[0242] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the status code information includes error code information; the error code information includes an error code type and an error code severity level;
[0243] Accordingly, the test result of the interface to be tested is determined according to the status code information in the request response message, including:
[0244] Classify the request response results according to the error code type in the request response message;
[0245] Determine the robustness evaluation result of the interface to be tested based on the classification results and the severity level of the error code;
[0246] According to the robustness evaluation results, the test results of the interface to be tested are determined.
[0247] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: the number of interfaces to be tested is at least two, and the method further includes:
[0248] Arrange the interfaces to be tested according to the test scenarios;
[0249] Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0250] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0251] Determine value information of the interface request parameter according to parameter configuration information and parameter type of the interface request parameter of the interface to be tested; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values;
[0252] Generate test cases for the interface to be tested based on the test type of the interface to be tested and the value information of the interface request parameters; the test types include full test and single parameter test.
[0253] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the parameter configuration information includes parameter boundary information and parameter rule information;
[0254] Accordingly, according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, including:
[0255] Determine the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter;
[0256] According to the parameter rule information and parameter type of the interface request parameter, normal value information and abnormal value information of the interface request parameter are determined.
[0257] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the number of interface request parameters is at least two, and the value information includes normal value information and abnormal value information;
[0258] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0259] If the test type is a full test, the value generator is called to generate the normal test value and abnormal test value of each interface request parameter according to the normal value information and abnormal value information of each interface request parameter;
[0260] According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
[0261] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: the number of interface request parameters is at least two, and the value information further includes null value information;
[0262] Accordingly, according to the test type of the interface to be tested and the value information of the interface request parameters, a test case for the interface to be tested is generated, including:
[0263] If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter;
[0264] According to the parameter test sequence, the value information of each interface request parameter is transformed in turn to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested.
[0265] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0266] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0267] For each target parameter, when the value information of other interface request parameters are all normal value information, the value information of the target parameter is transformed in turn to obtain a single quantity test case of the target parameter.
[0268] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: according to the parameter test sequence, the value information of each interface request parameter is transformed in sequence to obtain a single quantity test case of each interface request parameter corresponding to the interface to be tested, including:
[0269] According to the parameter test sequence, each interface request parameter is used as the target parameter in turn;
[0270] For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
[0271] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0272] Generate test requests based on test cases;
[0273] Sending a test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request;
[0274] Determine the test result of the interface to be tested based on the status code information in the request response message.
[0275] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: the status code information includes error code information; the error code information includes an error code type and an error code severity level;
[0276] Accordingly, the test result of the interface to be tested is determined according to the status code information in the request response message, including:
[0277] Classify the request response results according to the error code type in the request response message;
[0278] Determine the robustness evaluation result of the interface to be tested based on the classification results and the severity level of the error code;
[0279] According to the robustness evaluation results, the test results of the interface to be tested are determined.
[0280] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: the number of interfaces to be tested is at least two, and the method further includes:
[0281] Arrange the interfaces to be tested according to the test scenarios;
[0282] Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
[0283] It should be noted that the data involved in this application (including but not limited to messages and information in the test case processing process) are all data fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0284] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0285] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0286] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A test case processing method, characterized in that: The method comprises: Determine value information of the interface request parameter of the interface to be tested according to parameter configuration information and parameter type of the interface request parameter; wherein the value information includes at least two of normal value information, abnormal value information, null value information and boundary value information; the normal value information is value information that does not include boundary values; the number of the interface request parameters is at least two; Generate a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter; wherein the test type includes full test and single parameter test; full test refers to a test performed on the interface to be tested based on full normal test cases and full abnormal test cases; full normal test cases refer to test cases in which all interface request parameters in the test case are normal values; full abnormal test cases refer to test cases in which all interface request parameters in the test case are abnormal values; single parameter test refers to a test performed on the interface to be tested using a single test case; a single test case refers to a test case generated by transforming the value information of only one interface request parameter among all interface request parameters in the test case; If the test type is a single parameter test, the parameter test order of each interface request parameter is determined according to the parameter priority of each interface request parameter; According to the parameter test sequence, each interface request parameter is used as the target parameter in turn; For each target parameter, when the value information of the interface request parameters with higher priority than its parameter is normal value information, and the value information of the interface request parameters with lower priority than its parameter is null value information, the value information of the target parameter is transformed in turn to obtain a single test case for the target parameter.
2. The method according to claim 1, characterized in that The parameter configuration information includes parameter boundary information and parameter rule information; Correspondingly, determining the value information of the interface request parameter according to the parameter configuration information and parameter type of the interface request parameter of the interface to be tested includes: Determining the boundary value information of the interface request parameter according to the parameter boundary information of the interface request parameter; Normal value information and abnormal value information of the interface request parameter are determined according to the parameter rule information and parameter type of the interface request parameter.
3. The method according to claim 1, characterized in that The value information includes normal value information and abnormal value information; Correspondingly, generating a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter includes: If the test type is a full test, a value generator is called to generate a normal test value and an abnormal test value of each interface request parameter according to normal value information and abnormal value information of each interface request parameter; According to the normal test value of each interface request parameter, a full amount of normal test cases for the interface to be tested is generated, and according to the abnormal test value of each interface request parameter, a full amount of abnormal test cases for the interface to be tested is generated.
4. The method according to claim 1, characterized in that: The method further comprises: Generate a test request according to the test case; Sending the test request to the interface to be tested, so that the interface to be tested feeds back a request response message based on the test request; The test result of the interface to be tested is determined according to the status code information in the request response message.
5. The method according to claim 4, characterized in that The status code information includes error code information; the error code information includes error code type and error code severity level; Correspondingly, determining the test result of the interface to be tested according to the status code information in the request response message includes: Classifying the request response result according to the error code type in the request response message; Determining a robustness evaluation result of the interface to be tested according to the classification result and the severity level of the error code; According to the robustness evaluation result, a test result of the interface to be tested is determined.
6. The method according to claim 1, characterized in that The number of interfaces to be tested is at least two, and the method further includes: Arrange the interfaces to be tested according to the test scenarios; Each interface to be tested is tested according to the test frequency and test duration of each interface to be tested, as well as the test cases of each interface to be tested.
7. A test case processing device, characterized in that: The device comprises: A first determination module is used to determine value information of the interface request parameter of the interface to be tested according to parameter configuration information and parameter type of the interface request parameter; wherein the value information includes at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information that does not include boundary values; The first generation module is used to generate a test case for the interface to be tested according to the test type of the interface to be tested and the value information of the interface request parameter; wherein the test type includes full test and single parameter test; full test refers to a test performed on the interface to be tested based on full normal test cases and full abnormal test cases; full normal test cases refer to test cases in which all interface request parameters in the test case are normal values; full abnormal test cases refer to test cases in which all interface request parameters in the test case are abnormal values; single parameter test refers to a test performed on the interface to be tested using a single test case; a single test case refers to a test case generated by transforming the value information of only one interface request parameter among all interface request parameters in the test case; Testing the interface to be tested includes three stages: In the first stage, the interface to be tested is tested based on all normal test cases; In the second stage, the interface to be tested is first tested based on the full amount of normal test cases, then tested based on the single amount of test cases; and then tested based on the full amount of abnormal test cases; In the third stage, the interface to be tested is tested based on all normal test cases.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
