CN118132448B - Test case processing method, device, computer equipment and storage medium - Google Patents
Test case processing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN118132448B CN118132448B CN202410544946.8A CN202410544946A CN118132448B CN 118132448 B CN118132448 B CN 118132448B CN 202410544946 A CN202410544946 A CN 202410544946A CN 118132448 B CN118132448 B CN 118132448B
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- parameter
- value information
- tested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a test case processing method, a test case processing device, computer equipment and a storage medium. The method can be applied to the technical field of software development, and specifically comprises the following steps: determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; generating a test case of 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; the test types include full test and single parameter test. The method and the device not only consider the value information of the interface request parameters, but also consider the test type of the interface to be tested, so that the number of the finally and automatically generated test cases is more, the coverage is more comprehensive, and the generation efficiency of the test cases and the accuracy of the test results are effectively improved.
Description
Technical Field
The present application relates to the field of software development technologies, and in particular, to a test case processing method, a device, a computer device, and a storage medium.
Background
Software development is a systematic project, the software development flow includes development, test, online, operation, whether use the waterfall development mode, agile development mode or other development modes, this flow is basically the same from development to test. From the time of the requirement review, developers and testers will work on the business code implementation and use case test writing, respectively.
In the process of software development and testing, testing of a system interface is a relatively complex work, test cases are required to be manually written, test values of some interface request parameters are simply configured when the test cases are manually written, the test cases are written, and the number of the test cases which can be written is very limited due to low efficiency of manually writing the test cases. Therefore, by manually writing the test cases, not only the test efficiency is affected, but also the accuracy of the test result is affected.
Disclosure of Invention
Based on the foregoing, it is necessary to provide a test case processing method, apparatus, computer device and storage medium capable of improving test case generation efficiency and test accuracy.
In a first aspect, the present application provides a test case processing method, including:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In one embodiment, the parameter configuration information includes parameter boundary information and parameter rule information;
Correspondingly, according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, and the method comprises the following steps:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
In one embodiment, the number of the interface request parameters is at least two, and the value information comprises normal value information and abnormal value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
In one embodiment, the number of the interface request parameters is at least two, and the value information further comprises null value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is single parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
and according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interfaces to be tested.
In one embodiment, according to a parameter testing sequence, sequentially converting value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to an interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, according to a parameter testing sequence, sequentially converting value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to an interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the method further comprises:
generating a test request according to the test case;
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;
And determining the test result of the interface to be tested according to the status code information in the request response message.
In one embodiment, the status code information includes error code information; the error code information comprises an error code type and an 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 comprises the following steps:
Classifying the request response result according to the type of the error code in the request response message;
Determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
and determining a test result of the interface to be tested according to the robustness evaluation result.
In one embodiment, the number of interfaces to be tested is at least two, and the method further comprises:
according to the test scene, arranging each interface to be tested;
and testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
In a second aspect, the present application provides a test case processing method, where the apparatus includes:
the first determining module is used for determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
The first generation module is used for generating a test case of 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; the test types include full test and single parameter test.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
According to the method, the device, the computer equipment and the storage medium for processing the test cases, the value information of the interface request parameters is determined according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested, and the value information comprises at least two of normal value information, abnormal value information and boundary value information. And automatically generating a test case of the interface to be tested according to the test type (the test type comprises full test and single parameter test) of the interface to be tested and the value information of the interface request parameter. Compared with the traditional manual writing test case, the application considers the value information of each interface request parameter, and also considers the parameter type when determining the value information, so that the coverage of the value information obtained by determination is wider. When the test cases are generated, the value information of the interface request parameters is considered, the test types of the interfaces to be tested are also considered, so that the number of the finally and automatically generated test cases is more comprehensive, and therefore, the test case generation method is higher in intelligent degree, the automatically generated test cases can be realized, the number of the generated test cases is more, the coverage is wider, the generation efficiency of the test cases is improved, and the test results are more accurate.
Drawings
FIG. 1 is an application environment diagram of a test case processing method according to the present embodiment;
FIG. 2 is a flow chart of a first test case processing method according to the present embodiment;
FIG. 3 is a flowchart of generating a full test case according to the present embodiment;
FIG. 4 is a flowchart of generating a single test case according to the present embodiment;
FIG. 5 is a flowchart of a second test case processing method according to the present embodiment;
FIG. 6 is a flowchart illustrating a third test case processing method according to the present embodiment;
FIG. 7 is a flowchart of a fourth test case processing method according to the present embodiment;
FIG. 8 is a block diagram of a test case processing apparatus according to the present embodiment;
Fig. 9 is an internal structural diagram of the computer device provided in the present embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The conventional manner of writing test cases has the following drawbacks: 1. the existing test cases are usually written manually, and the test cases are written according to the interface request address, the interface request mode and the interface request parameters to be tested. Because the types and the number of the interface request parameters may all comprise a plurality of interface request parameters, and basically each interface request parameter comprises a normal constant and an abnormal parameter, manually configuring the interface request parameters consumes labor, and the efficiency of manually writing test cases is low. 2. The conventional method for manually writing the test cases also has the problem of insufficient coverage conditions, and most of the time, the types and the number of the interface request parameters are multiple, if different scene conditions are required to be covered for each interface request parameter, a great deal of effort is required to be put into, and a plurality of parameters are generally selected randomly for each interface request parameter to generate the test cases, so that the coverage conditions of the test cases are insufficient. 3. In the actual test process of the test cases, anomalies are often tested, some are caused by data and some are caused by code quality, in order to better record the test conditions and find the sources of anomalies and solve related problems, the test results generally need to be recorded and classified manually, and not only the abnormal results but also the test cases causing the abnormal results need to be classified, so that the current classification mode is adopted, not only the classification efficiency is influenced, but also the regression test efficiency is influenced. 4. The current test mode basically only adopts a fixed flow to test one interface, and cannot be combined with an actual service scene to test the interface, so that the potential problem of the target system cannot be tested.
The testers typically submit the bug manually, distribute it to the designated developer, and return to the verification test after the relevant developer finishes processing. Many problems are often tested in the first round of testing, and the collection of problems needs to be collected and classified one by one during the whole test process, and the manual recording and classification of relevant test results of normal/abnormal/bug of the process is repeated manual processing and recording.
In the subsequent continuous iteration test, the problem items are gradually reduced, the problems before the regression test need the regression test, the test is required to be carried out for one time before the regression test is normal, and the test flow repeatability is high; because the used test tools such as postman and the problem recording tools such as Buddhist channels are generally isolated, the overall traceability of the bug life cycle is not high, including the occurrence time, the frequency and the subsequent iteration repair rate, and the follow-up repeated disc summarization assistance of the test problems is not great.
The test case processing method provided by the embodiment of the application can be applied to an application environment shown in FIG. 1. The test system 102 determines the value information of the interface request parameter according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested of the target system 104. And generating test cases of the interfaces to be tested of the target system 104 according to the test types of the interfaces to be tested and the value information of the interface request parameters. The value information comprises at least two of normal value information, abnormal value information and boundary value information, and the test type comprises full test and single parameter test.
The test system is a system for testing the interface to be tested, and can be test equipment or a server. The test device may be a terminal device, for example, a computer with a relatively powerful function. The server can be an independent server or a server cluster, and the test system can generate test cases.
The target system refers to a system which needs to be subjected to interface test, and can be a software system or a system obtained by combining software and hardware.
In one embodiment, fig. 2 is a flow chart of a test case processing method according to an embodiment of the present application, and the test system in fig. 1 is taken as an example to illustrate the method, and the method includes the following steps:
S201, according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested, the value information of the interface request parameters is determined. Wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not include a boundary value.
The interface to be tested is an interface with test requirements. The interface request parameters refer to interface request parameters in the interface to be tested. The interface generally includes an interface request manner, an interface request address, and an interface request parameter. The interface request mode generally refers to an operation mode of resources, and mainly comprises adding, deleting, inquiring, modifying and the like. The interface request address generally comprises fixed and dynamic changes, and the dynamic state generally comprises service data; fixed addresses are as follows: admin/gateway-devices; the dynamic address, such as/admin/gateway-device/{ vin }, includes the dynamic parameter frame number vin to be transferred. The interface request address refers to a resource access address. The parameter configuration information refers to relevant configuration information of the interface request parameter, and mainly comprises parameter boundary information and parameter rule information of the interface request parameter. The parameter type refers to the type of each interface request parameter, and generally includes a numeric type (e.g., 1,2,3, etc.), a string type (e.g., "abc", "123@qq.com", etc.), a bool type (e.g., true, false, etc.), a time type (e.g., "2024-02-17T08:30:00Z", etc.). The value information refers to range information of available values of the interface request parameters. The normal value information is parameter value information meeting the requirements of the defined interface request parameters. The boundary value information refers to a boundary value or a critical value of the interface request parameter. The abnormal value information refers to parameter value information which does not accord with the parameter configuration rule of the interface request. It should be noted that the value information may further include null value information, which means that the parameter value of the interface request parameter is null.
An alternative implementation manner of this embodiment is as follows: and determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters. And determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters. For example, if a certain interface request parameter is age information, and the range of the age information is 0-100, 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, the parameter type is numerical, the normal value information of the interface request parameter is 0-100, and the abnormal value information is less than 0 and more than 100. That is, the numerical parameters and the time-type parameters generally have boundary value information, normal value information, and abnormal value information. The boundary value information is generally a specific value, and the normal value information and the abnormal value information are generally range values. The bool type parameter and the string type parameter may have only normal value information and abnormal value information, and no boundary value information.
Another alternative implementation of this embodiment is: inputting the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested into a value-taking tool, and determining the value-taking information of the interface request parameters by the value-taking tool. The value tool may be, but is not limited to, a trained neural network model.
Optionally, in this embodiment, the parameter configuration information of the interface to be tested may be obtained by analyzing an interface template of the interface to be tested.
S202, according to the test type of the interface to be tested and the value information of the interface request parameters, generating a test case of the interface to be tested. The test types include full test and single parameter test.
The test case is a test document for performing performance test on the interface to be tested, and generally comprises an interface request address, an interface request mode and an interface request parameter. The test type is a type for testing the interface to be tested based on the test case and mainly comprises a full-quantity test and a single-parameter test, and the full-quantity test is a test for testing the interface to be tested based on the full-quantity normal test case and the full-quantity abnormal test case. The full normal test cases refer to test cases in which all interface request parameters in the test cases are normal values. The full-volume abnormal test case refers to a test case in which all interface request parameters in the test case are abnormal values. The single parameter test refers to the test of the interface to be tested by using a single test case. The single test case refers to a test case generated by transforming the value information of only one interface request parameter in all interface request parameters in the test case.
An alternative implementation manner of this embodiment is as follows: and 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 the test case of the interface to be tested according to the parameter value of the interface request parameter.
Another alternative implementation of this embodiment is: inputting the test type of the interface to be tested and the value information of the interface request parameters into a test case generating tool, and generating the test case meeting the requirement of the test type of the interface to be tested and the value information of the interface request parameters by the test case generating tool. Wherein the test case generation tool employs, but is not limited to, a neural network model.
Optionally, in this embodiment, the interface set may be created according to the project requirement. Wherein the interface to be tested is an interface in the interface set. For interfaces in the interface collection, the interfaces may be added manually or may be generated by parsing the interface document and development tool swagger. For example, for a user management system, an interface set of functions such as adding, deleting, modifying, querying, etc. can be created according to management requirements. After the Interface set is created, the interfaces in the Interface set can be checked through a UI (User Interface) Interface, and relevant parameters of the interfaces can be configured.
According to the test case processing method, the value information of the interface request parameters is determined according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested, and the value information comprises at least two of normal value information, abnormal value information and boundary value information. And automatically generating a test case of the interface to be tested according to the test type (the test type comprises full test and single parameter test) of the interface to be tested and the value information of the interface request parameter. Compared with the traditional manual writing test case, the application considers the value information of each interface request parameter, and also considers the parameter type when determining the value information, so that the coverage of the value information obtained by determination is wider. When the test cases are generated, the value information of the interface request parameters is considered, the test types of the interfaces to be tested are also considered, so that the number of the finally and automatically generated test cases is more comprehensive, and therefore, the test case generation method is higher in intelligent degree, the automatically generated test cases can be realized, the number of the generated test cases is more, the coverage is wider, the generation efficiency of the test cases is improved, and the test results are more accurate.
In one embodiment, the number of the interface request parameters is more than two, and the value information at least includes normal value information and abnormal value information, in this case, in order to obtain a full normal test case and a full abnormal test case that cover more comprehensively, as shown in fig. 3, an alternative implementation manner of S202 includes:
S301, if the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to normal value information and abnormal value information of each interface request parameter.
The numerical value generator is a generating tool capable of automatically and randomly generating required numerical values according to set conditions, and is mainly used for automatically and randomly generating test values. The normal test value refers to a value generated by a value generator from normal value information. For example, if the normal value information is a range value of 0 to 100, that is, a value between 0 and 100 is a normal value, the value generator is based on the range of 0 to 100, and a randomly generated value (for example, 50) is a normal test value. The abnormal test value is a value generated by a value generator based on abnormal value information. For example, if the outlier information is a range value less than 0 or greater than 100, that is, a value corresponding to a value between less than 0 or greater than 100 is an outlier, the value generator randomly generates a value (e.g., 110) based on the range of less than 0 or greater than 100 is an outlier.
Optionally, in this embodiment, a value generator is invoked to generate a normal test value of each interface request parameter according to normal value information of each interface request parameter. And calling a value generator, and generating 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, and a normal test value of each interface request parameter is randomly generated according to normal value information of each interface request parameter. And calling a value generator, and randomly generating an abnormal test value of each interface request parameter according to the abnormal value information of each interface request parameter.
Illustratively, taking the user information adding interface as an example, it is assumed that the interface request parameters of the user information adding interface include a user name, an age, and a 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 numerical value generator, the normal test values of the interface request parameters corresponding to the user name, the age and the home address can be randomly generated according to the normal value information of the user name, the age and the home address. Similarly, by calling the value generator, the abnormal test value of the interface request parameter corresponding to the user name, the age and the home address can be randomly generated according to the abnormal value information of the user name, the age and the home address.
S302, generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
Optionally, in this embodiment, according to the normal test value, the interface request address and the interface request parameter of each interface request parameter, a total normal test case of the interface to be tested is automatically generated. And automatically generating the total abnormal test cases of the interfaces to be tested according to the abnormal test values of the interface request parameters, the interface request addresses and the interface request parameters.
In this embodiment, when the test type is a full test, the numerical generator may be invoked to automatically generate a normal test value and an abnormal test value of each interface request parameter according to the normal value information and the abnormal value information of each interface request parameter; generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter, automatically and randomly generating normal value information and abnormal value information of each interface request parameter by calling a numerical value generator in the embodiment, compared with the manual writing of the test cases, the method considers the test type, and can automatically generate the full normal test cases and the full abnormal test cases with more comprehensive coverage under the condition that the test type is the full test, thereby not only increasing the writing efficiency of the test cases, but also having wider coverage and more reliable test results.
In one embodiment, the number of the interface request parameters is more than two, and the value information includes null value information, in this case, in order to obtain a single test case with more comprehensive coverage, as shown in fig. 4, an alternative implementation of S202 includes:
s401, if the test type is single parameter test, determining the parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter.
The null value information refers to that the parameter value of the interface request parameter is a null value. The parameter priority refers to the priority order of the interface request parameters, and the parameter priority of the interface request parameters may be set manually, or the order of the interface request parameters may be used as the priority order of the interface request parameters, for example, the higher the interface request parameters are, the higher the level of the parameter priority is. The parameter test order is a test order in which each interface of the interfaces to be tested requests parameters.
Optionally, in this embodiment, the priority order of the interface request parameters is obtained by sorting the interface request parameters according to the parameter priority of the interface request parameters, and the priority order of the interface request parameters is used as the parameter test order of the interface request parameters.
Illustratively, taking the user information addition interface as an example, it is assumed that the interface request parameters of the user information addition interface include a user name, an age, a home address, and the like. The priority of the user name parameter is highest, the home address is the home address, and finally the age, the priority order of the interface request parameters of the user information adding interface is the user name, the home address and the age, and the priority order is used as the parameter test order of each interface request parameter of the user information adding interface under the condition that the test type is single parameter test.
S402, according to the parameter testing sequence, the value information of each interface request parameter is sequentially transformed, and a single test case of each interface request parameter corresponding to the interface to be tested is obtained.
An alternative implementation manner of this embodiment is as follows: and sequentially taking the request parameters of each interface as target parameters according to the parameter test sequence. And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
Taking the user information adding interface as an example, the parameter test sequence of the interface request parameters of the user information adding interface is a user name, a home address and an age. According to the parameter test sequence, a control variable method is adopted, firstly, a user name is taken as a target parameter, when the user name is taken as the target parameter, the value information of the home address and the age are normal value information, namely, the parameter test values of the home address and the age are generated randomly by calling a numerical generator, the value information of the user name is converted in sequence, null value information, abnormal value information and boundary value information can be converted, finally, the user name is converted into normal value information, different test values are generated according to the value information through the numerical generator, namely, when the value information of the user name is null value information and the value information of the home address and the age is normal value information, part of test cases are generated; generating partial test cases when the value information of the user name is abnormal value information and the value information of the home address and the age is normal value information; when the value information of the user name is boundary value information and the value information of the home address and the age is normal value information, generating partial test cases, finally converting the value information of the user name into normal value information, taking the home address as a target parameter, and so on, sequentially taking each interface request parameter as the target parameter according to a parameter test sequence, and sequentially converting the value information of the target parameter under the condition that the value information of the rest interface request parameters is normal value information, so as to obtain corresponding test cases, and taking all the obtained test cases as single test cases.
Another alternative implementation of this embodiment is: and sequentially taking the request parameters of each interface as target parameters according to the parameter test sequence. And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
Taking the user information adding interface as an example, the parameter test sequence of the interface request parameters of the user information adding interface is a user name, a home address and an age. According to the parameter test sequence, a control variable method is adopted, firstly, a user name is used as a target parameter, when the user name is used as the target parameter, the priority of the parameters of the home address and the age is lower than that of the user name, therefore, the value information of the home address and the age is null value information, in this case, the value information of the user name is converted between abnormal value information and boundary value information, and in the conversion process, a corresponding abnormal test value and boundary test value are generated by calling a value generator, and in combination with the normal test value which is randomly generated for interface request parameters such as the home address and the age, the corresponding test case is obtained. That is, when the value information of the user name is abnormal value information and the value information of the home address and the age is normal value information, generating a part of test cases; when the value information of the user name is null value information and the value information of the home address and the age is normal value information, generating partial test cases, finally converting the value information of the user name into normal value information, taking the home address as a target parameter, in this case, taking all the obtained test cases as single test cases, wherein the value information of the age is null value information and the like according to the parameter test sequence, taking each interface request parameter as the target parameter, and when the value information of the interface request parameter with the higher parameter priority than the target parameter is normal value information and the value information of the interface request parameter with the lower priority than the target parameter is null value information, converting the value information of the target parameter in sequence to obtain the corresponding test cases of the target parameter.
Yet another alternative implementation of this embodiment is: and sequentially taking the request parameters of each interface as target parameters according to the parameter test sequence. And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a first test case of the target parameter. And sequentially taking the request parameters of each interface as target parameters according to the parameter test sequence. And aiming at each target parameter, under the condition that the value information of the interface request parameter with the higher parameter priority than the target parameter is normal value information and the value information of the interface request parameter with the lower priority than the target parameter is null value information, sequentially converting the value information of the target parameter to obtain a second test case of the target parameter. And taking the first test case and the second test case as single test cases.
In this embodiment, in the case that the test type is a single parameter test, the present application first determines the parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter. And then, according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interface to be tested. The single test case obtained based on the embodiment covers the test case of each interface request parameter under the conditions of normal, abnormal, boundary and null values, and can test each interface request parameter, thereby increasing the accuracy of test results.
In one embodiment, to determine the test result more accurately, as shown in fig. 5, an alternative implementation of the test case processing method includes:
S501, generating a test request according to the test case.
The test request refers to a request access instruction initiated based on the test case.
Optionally, in this embodiment, a request format of the test request is obtained, and based on the test case, request content corresponding to the request format is determined, so as to obtain the test request.
S502, a test request is sent 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 request response message refers to a response message fed back to the test system after the interface to be tested receives the test request.
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, a request response message is fed back according to the request content in the test request.
S503, determining the test result of the interface to be tested according to the status code information in the request response message.
The status code information refers to indication code information for indicating whether the response content of the request response message is normal response content or abnormal response content, and includes, but is not limited to, error code types, for example, tsp_10001 indicates that data cannot be null), tsp_10002 indicates that data is not in a valid range, tsp_10003 indicates that service data is not present, tsp_10004 indicates that system is abnormal, and the like, where each error code type has a corresponding error code severity level and is used to characterize error severity levels of different error code types.
An alternative implementation manner of this embodiment is as follows: the status code information includes error code information; the error code information includes an error code type and an error code severity level.
According to the status code information in the request response message, the optional implementation manner of determining the test result of the interface to be tested is as follows: and classifying the request response result according to the type of the error code in the request response message. And determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level. And determining a test result of the interface to be tested according to the robustness evaluation result. According to the classification result and the error code severity level, an alternative implementation way for determining the robustness evaluation result of the interface to be tested is as follows: obtaining the message quantity of request response messages corresponding to different error code types, determining the weight value corresponding to each error code type according to the error code severity level corresponding to each error code type, carrying out weighted summation processing according to the initial score, the weight value and the corresponding message quantity corresponding to each error code type, obtaining the robustness score of the interface to be tested, and taking the robustness score as the robustness evaluation result of the interface to be tested. In this embodiment, according to the robustness evaluation result, an alternative implementation manner of determining the test result of the interface to be tested is as follows: and taking the robustness evaluation result as a test result of the interface to be tested. In this embodiment, according to the robustness evaluation result, another alternative implementation manner of determining the test result of the interface to be tested is as follows: the comprehensive evaluation can be performed according to the robustness evaluation result and other evaluation results (such as accuracy, timeliness and the like) to obtain a comprehensive evaluation result, and the comprehensive evaluation is recorded as a test result of the interface to be tested.
In this embodiment, after the request response message is obtained, the request response message can be automatically classified according to the error code information in the request response message, and compared with the traditional manual recording and classifying mode, the automatic classifying mode adopted by the application greatly improves the classifying efficiency. In addition, the embodiment can also determine the robustness evaluation result of the interface to be tested according to the classification result and the error code severity level, and the conventional manual classification mode can only roughly judge the robustness of the interface to be tested through manual experience, and does not have high reference value.
Another alternative implementation of this embodiment is: the status code information comprises error code information and normal code information, and the error code information comprises error code types and error code severity levels corresponding to the error code types. And acquiring the normal message quantity of the request response message with the normal code information, and acquiring a first test score according to the normal message quantity and the corresponding message score. And obtaining the message quantity of the request response messages corresponding to different error code types, determining the weight value corresponding to each error code type according to the error code severity level corresponding to each error code type, and carrying out weighted summation processing according to the initial score, the weight value and the corresponding message quantity corresponding to each error code type to obtain a second test score. And determining a test total score according to the first test score and the second test score, wherein the test total score can be used as a test result of the interface to be tested.
Optionally, in this embodiment, each request response message and the test case corresponding to the request response message may be categorized according to the error code type, and the storage processing may be performed. And subsequent access and inquiry according to the error code type are facilitated, and the method is used for subsequent code quality analysis and projects.
In this embodiment, a test request is generated according to a test case. And 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. And determining the test result of the interface to be tested according to the status code information in the request response message. The application can determine the overall test condition based on the test result and accurately know the interface performance condition of the tested interface. Based on the test result, the system robustness of the tested system (namely the target system) can be evaluated, and the target system development and iterative upgrading are facilitated.
In one embodiment, in order to test to better conform to the actual application scenario, as shown in fig. 6, an alternative implementation of the test case processing method includes:
S601, arranging each interface to be tested according to the test scene.
The test scene is used for simulating various conditions and operations of a user in the actual use process from the perspective of the user. The interface test sequence refers to the obtained interface use sequence by simulating the use sequence of the user.
An alternative implementation manner of this embodiment is as follows: according to the test scene, determining an interface access flow under the test scene, determining an interface test sequence according to the interface access flow, and arranging each interface to be tested according to the interface test sequence.
Another alternative implementation of this embodiment is: according to the test scene, candidate interfaces are determined, interfaces to be tested are randomly selected from the candidate interfaces, and the interfaces to be tested are arranged.
S602, testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
The test frequency refers to the test frequency of each interface to be tested, for example, how many times one minute is required to be tested. The test duration refers to the overall duration of the test in this test scenario, e.g., 10 minutes, 30 minutes, etc.
Optionally, in this embodiment, first, according to a test scenario, an interface test sequence between the interfaces to be tested is determined, and test cases corresponding to the interfaces to be tested are obtained. And calling the corresponding test cases of the interfaces to be tested according to the interface test sequence, the test frequency and the test duration between the interfaces to be tested, and testing the interfaces to be tested.
Optionally, in this embodiment, the interface to be tested may be selected randomly according to the test scenario, and the test case corresponding to each interface to be tested may be obtained. And testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
Optionally, in this embodiment, according to the interface to be tested and the test scenario, test cases meeting the requirements (for example, test cases with normal all request parameters) may 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 the test cases is described in detail in the above embodiments, and will not be repeated here.
In this embodiment, when testing is performed, a test scenario is also considered, and according to the test scenario, an interface test sequence between the interfaces to be tested is determined. And testing the interfaces to be tested according to the interface testing sequence, the testing frequency and the testing time length between the interfaces to be tested and the testing cases of the interfaces to be tested. The test is carried out by combining the test scene, the interface use scene of service intersection and data intersection in the actual use process can be simulated, the problems that some single interfaces cannot be tested, such as the problem that lock tables can appear by simultaneous modification and new addition, and the problem that dirty data can appear by deletion and inquiry can be exposed, so that the concurrency is increased, and a certain pressure test can be carried out on a target system.
In one embodiment, as shown in fig. 7, another alternative implementation of the test case testing method includes:
S701, according to the parameter boundary information of the interface request parameter, determining the boundary value information of the interface request parameter.
S702, determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
S703, 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. And then S704 or S706 is performed.
The normal value information is value information which does not include a boundary value.
And S704, if the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter.
S705, generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter. After that, S7010 is executed.
S706, if the test type is single parameter test, determining the parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter.
S707, according to the parameter test sequence, each interface request parameter is sequentially used as a target parameter. And then S708 or S709 is performed.
S708, for each target parameter, under the condition that the value information of the other interface request parameters is normal value information, the value information of the target parameter is sequentially transformed to obtain a single test case of the target parameter. After that, S7010 is executed.
S709, for each target parameter, when the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially transforming the value information of the target parameter to obtain a single test case of the target parameter. After that, S7010 is executed.
S7010, a test request is generated according to the test case.
The test cases comprise a full normal test case, a full abnormal test case and single test cases corresponding to each interface request parameter.
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;
S7012, the request response result is classified according to the type of the error code in the request response message.
S7013, determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level.
S7014, determining a test result of the interface to be tested according to the robustness evaluation result.
The embodiment also comprises a test case processing method combined with a test scene, which comprises the following specific steps:
and arranging each interface to be tested according to the test scene.
And testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
The test method for the interface to be tested in this embodiment includes the following three stages:
The first stage, testing the interface to be tested based on the total normal test cases;
and in the second stage, the interfaces to be tested are tested based on the full normal test cases, and then the interfaces to be tested are tested based on the single test cases.
And in the third stage, the interface to be tested is tested based on the total abnormal test cases, and then the interface to be tested is tested based on the total normal test cases.
According to the test case processing method of the embodiment, the value information of the interface request parameters is determined according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested, and the value information comprises at least two of normal value information, abnormal value information and boundary value information. And automatically generating a test case of the interface to be tested according to the test type (the test type comprises full test and single parameter test) of the interface to be tested and the value information of the interface request parameter. Compared with the traditional manual writing test case, the application considers the value information of each interface request parameter, and also considers the parameter type when determining the value information, so that the coverage of the value information obtained by determination is wider. When the test cases are generated, the value information of the interface request parameters is considered, the test types of the interfaces to be tested are also considered, so that the number of the finally and automatically generated test cases is more comprehensive, and therefore, the test case generation method is higher in intelligent degree, the automatically generated test cases can be realized, the number of the generated test cases is more, the coverage is wider, the generation efficiency of the test cases is improved, and the test results are more accurate.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a test case processing device for realizing the test case processing method. The implementation scheme of the solution to the problem provided by the device is similar to the implementation scheme recorded in the method, so the specific limitation of the embodiment of the one or more test case processing devices provided below may refer to the limitation of the test case processing method hereinabove, and will not be repeated herein.
In one embodiment, a block diagram of a test case processing device in one embodiment is shown by FIG. 8. As shown in fig. 8, there is provided a test case processing apparatus 800 including: a first determination module 801 and a first generation module 802, wherein:
A first determining module 801, configured to determine, according to parameter configuration information and parameter type of an interface request parameter of an interface to be tested, value information of the interface request parameter; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the parameter configuration information comprises parameter boundary information and parameter rule information; the number of interface request parameters is at least two; the normal value information is value information which does not include a boundary value.
The first generating module 802 is configured to generate a test case of 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; the test types include full test and single parameter test.
In one embodiment, the first determining module 801 in fig. 8 above is further specifically configured to:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
In one embodiment, the first generating module 802 in fig. 8 is further specifically configured to:
If the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
In one embodiment, the first generating module 802 in fig. 8 is further specifically configured to:
If the test type is single parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
and according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interfaces to be tested.
In one embodiment, the first generating module 802 in fig. 8 is further specifically configured to:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the first generating module 802 in fig. 8 is further specifically configured to:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the test case processing apparatus 800 in fig. 8 further includes:
the second generation module is used for generating a test request according to the test case;
the sending module is used for 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;
And the second determining module is used for determining the test result of the interface to be tested according to the status code information in the request response message.
In one embodiment, the status code information includes error code information; the error code information comprises an error code type and an error code severity level; on the basis, the second determining module is further specifically configured to:
Classifying the request response result according to the type of the error code in the request response message;
Determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
And according to the robustness evaluation result, testing the interface to be tested.
In one embodiment, the test case processing apparatus 800 in fig. 8 further includes:
the third determining module is used for arranging the interfaces to be tested according to the test scene;
The test module is used for testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
The modules in the test case processing device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a platform side, and the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing registration authentication information. The network interface of the computer device is used for communicating with an external user side through a network connection. The computer program, when executed by a processor, implements a test case processing method.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 9 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements are applicable, and in particular, the computer device may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In one embodiment, the processor when executing the computer program further performs the steps of: the parameter configuration information comprises parameter boundary information and parameter rule information;
Correspondingly, according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, and the method comprises the following steps:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
In one embodiment, the processor when executing the computer program further performs the steps of: the number of the interface request parameters is at least two, and the value information comprises normal value information and abnormal value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
In one embodiment, the processor when executing the computer program further performs the steps of: the number of the interface request parameters is at least two, and the value information also comprises null value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is single parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
and according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interfaces to be tested.
In one embodiment, the processor when executing the computer program further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the processor when executing the computer program further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the processor when executing the computer program further performs the steps of:
generating a test request according to the test case;
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;
And determining the test result of the interface to be tested according to the status code information in the request response message.
In one embodiment, the processor when executing the computer program further performs the steps of: the status code information includes error code information; the error code information comprises an error code type and an 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 comprises the following steps:
Classifying the request response result according to the type of the error code in the request response message;
Determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
and determining a test result of the interface to be tested according to the robustness evaluation result.
In one embodiment, the processor when executing the computer program further performs the steps of: the number of interfaces to be tested is at least two, and the method further comprises:
according to the test scene, arranging each interface to be tested;
and testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In one embodiment, the computer program when executed by the processor further performs the steps of: the parameter configuration information comprises parameter boundary information and parameter rule information;
Correspondingly, according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, and the method comprises the following steps:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of the interface request parameters is at least two, and the value information comprises normal value information and abnormal value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of the interface request parameters is at least two, and the value information also comprises null value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is single parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
and according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interfaces to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a test request according to the test case;
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;
And determining the test result of the interface to be tested according to the status code information in the request response message.
In one embodiment, the computer program when executed by the processor further performs the steps of: the status code information includes error code information; the error code information comprises an error code type and an 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 comprises the following steps:
Classifying the request response result according to the type of the error code in the request response message;
Determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
and determining a test result of the interface to be tested according to the robustness evaluation result.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of interfaces to be tested is at least two, and the method further comprises:
according to the test scene, arranging each interface to be tested;
and testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
Determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
generating a test case of 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; the test types include full test and single parameter test.
In one embodiment, the computer program when executed by the processor further performs the steps of: the parameter configuration information comprises parameter boundary information and parameter rule information;
Correspondingly, according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested, the value information of the interface request parameter is determined, and the method comprises the following steps:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of the interface request parameters is at least two, and the value information comprises normal value information and abnormal value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is full test, a numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
generating a total normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a total abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of the interface request parameters is at least two, and the value information also comprises null value information;
correspondingly, according to the test type of the interface to be tested and the value information of the interface request parameters, generating the test case of the interface to be tested comprises the following steps:
If the test type is single parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
and according to the parameter testing sequence, sequentially converting the value information of the interface request parameters to obtain single test cases of the interface request parameters corresponding to the interfaces to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And under the condition that the value information of the other interface request parameters is normal value information, aiming at each target parameter, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of: according to the parameter testing sequence, sequentially converting the value information of each interface request parameter to obtain a single test case of each interface request parameter corresponding to the interface to be tested, including:
sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a test request according to the test case;
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;
And determining the test result of the interface to be tested according to the status code information in the request response message.
In one embodiment, the computer program when executed by the processor further performs the steps of: the status code information includes error code information; the error code information comprises an error code type and an 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 comprises the following steps:
Classifying the request response result according to the type of the error code in the request response message;
Determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
and determining a test result of the interface to be tested according to the robustness evaluation result.
In one embodiment, the computer program when executed by the processor further performs the steps of: the number of interfaces to be tested is at least two, and the method further comprises:
according to the test scene, arranging each interface to be tested;
and testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
It should be noted that, the data (including, but not limited to, messages, information, etc. in the process of processing the test case) related to the present application are all data fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magneto-resistive random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.
Claims (9)
1. A method for processing a test case, the method comprising:
Determining the value information of interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information, null value information and boundary value information; the normal value information is value information which does not contain boundary values; the number of the interface request parameters is at least two;
Generating a test case of 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 types include full-scale test and single-parameter test; the full test is based on the full normal test cases and the full abnormal test cases; the full normal test cases refer to test cases in which all interface request parameters in the test cases are normal values; the full-quantity abnormal test case is a test case in which all interface request parameters in the test case are abnormal values; the single parameter test is to test the interface to be tested by using a single test case; the single test case refers to a test case generated by transforming the value information of only one interface request parameter in all interface request parameters in the test case;
if the test type is single-parameter test, determining a parameter test sequence of each interface request parameter according to the parameter priority of each interface request parameter;
Sequentially taking each interface request parameter as a target parameter according to the parameter test sequence;
And aiming at each target parameter, under the condition that the value information of the interface request parameter higher than the parameter priority is normal value information and the value information of the interface request parameter lower than the parameter priority is null value information, sequentially converting the value information of the target parameter to obtain a single test case of the target parameter.
2. The method of claim 1, wherein the parameter configuration information includes parameter boundary information and parameter rule information;
Correspondingly, the determining the value information of the interface request parameter according to the parameter configuration information and the parameter type of the interface request parameter of the interface to be tested includes:
Determining boundary value information of the interface request parameters according to the parameter boundary information of the interface request parameters;
and determining normal value information and abnormal value information of the interface request parameters according to the parameter rule information and the parameter type of the interface request parameters.
3. The method of claim 1, wherein the value information comprises normal value information and abnormal value information;
Correspondingly, the generating the test case of 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 numerical value generator is called, and a normal test value and an abnormal test value of each interface request parameter are generated according to the normal value information and the abnormal value information of each interface request parameter;
Generating a full normal test case of the interface to be tested according to the normal test value of each interface request parameter, and generating a full abnormal test case of the interface to be tested according to the abnormal test value of each interface request parameter.
4. The method according to claim 1, wherein the method further comprises:
Generating 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;
and determining the test result of the interface to be tested according to the status code information in the request response message.
5. The method of claim 4, wherein the status code information comprises error code information; the error code information comprises an error code type and an error code severity level;
correspondingly, the 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 type of the error code in the request response message;
determining a robustness evaluation result of the interface to be tested according to the classification result and the error code severity level;
and determining the test result of the interface to be tested according to the robustness evaluation result.
6. The method of claim 1, wherein the number of interfaces to be tested is at least two, the method further comprising:
according to the test scene, arranging each interface to be tested;
and testing each interface to be tested according to the test frequency and the test duration of each interface to be tested and the test case of each interface to be tested.
7. A test case processing apparatus, the apparatus comprising:
the first determining module is used for determining the value information of the interface request parameters according to the parameter configuration information and the parameter type of the interface request parameters of the interface to be tested; wherein the value information comprises at least two of normal value information, abnormal value information and boundary value information; the normal value information is value information which does not contain boundary values;
The first generation module is used for generating a test case of 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 types include full-scale test and single-parameter test; the full test is based on the full normal test cases and the full abnormal test cases; the full normal test cases refer to test cases in which all interface request parameters in the test cases are normal values; the full-quantity abnormal test case is a test case in which all interface request parameters in the test case are abnormal values; the single parameter test is to test the interface to be tested by using a single test case; the single test case refers to a test case generated by transforming the value information of only one interface request parameter in all interface request parameters in the test case;
testing is carried out on the interface to be tested, and the testing method comprises three stages:
The first stage, testing the interface to be tested based on the total normal test cases;
the second stage, firstly, testing the interface to be tested based on the full normal test cases, and then testing the interface to be tested based on the single test case; testing the interface to be tested based on the total abnormal test cases;
and step three, testing the interface to be tested based on the total normal test cases.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410544946.8A CN118132448B (en) | 2024-05-06 | 2024-05-06 | Test case processing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410544946.8A CN118132448B (en) | 2024-05-06 | 2024-05-06 | Test case processing method, device, computer equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118132448A CN118132448A (en) | 2024-06-04 |
| CN118132448B true CN118132448B (en) | 2024-09-20 |
Family
ID=91236154
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410544946.8A Active CN118132448B (en) | 2024-05-06 | 2024-05-06 | Test case processing method, device, computer equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118132448B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN118885406B (en) * | 2024-10-08 | 2025-01-17 | 天津南大通用数据技术股份有限公司 | Database cluster abnormity testing method and device |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109947646A (en) * | 2019-03-13 | 2019-06-28 | 平安信托有限责任公司 | Interface test method, device, computer equipment and storage medium |
| CN110798376A (en) * | 2019-10-09 | 2020-02-14 | 苏宁云计算有限公司 | Interface testing method and device, computer equipment and storage medium |
| CN112463586A (en) * | 2020-10-29 | 2021-03-09 | 苏州浪潮智能科技有限公司 | Method and medium for automatically generating application program interface test case |
| CN117033212A (en) * | 2023-08-09 | 2023-11-10 | 潍柴动力股份有限公司 | Method for automatically generating interface test case and test case generating device |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108897687B (en) * | 2018-06-29 | 2022-04-01 | 泰华智慧产业集团股份有限公司 | API automatic testing method and system based on data driving |
| CN109710476B (en) * | 2018-12-26 | 2022-04-29 | 中国银行股份有限公司 | System interface robustness testing method and device |
| CN111475376B (en) * | 2020-03-25 | 2024-01-30 | 微民保险代理有限公司 | Method, apparatus, computer device and storage medium for processing test data |
| CN114780106A (en) * | 2022-05-06 | 2022-07-22 | 北京赛博云睿智能科技有限公司 | Interface function self-development system |
| CN115952508A (en) * | 2022-12-14 | 2023-04-11 | 上海时代光华教育发展有限公司 | Test case test generation method, system, computer device and storage medium |
-
2024
- 2024-05-06 CN CN202410544946.8A patent/CN118132448B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109947646A (en) * | 2019-03-13 | 2019-06-28 | 平安信托有限责任公司 | Interface test method, device, computer equipment and storage medium |
| CN110798376A (en) * | 2019-10-09 | 2020-02-14 | 苏宁云计算有限公司 | Interface testing method and device, computer equipment and storage medium |
| CN112463586A (en) * | 2020-10-29 | 2021-03-09 | 苏州浪潮智能科技有限公司 | Method and medium for automatically generating application program interface test case |
| CN117033212A (en) * | 2023-08-09 | 2023-11-10 | 潍柴动力股份有限公司 | Method for automatically generating interface test case and test case generating device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118132448A (en) | 2024-06-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9594797B2 (en) | Data quality assessment | |
| CN107665171B (en) | Automatic regression testing method and device | |
| CN113127347B (en) | Interface testing method, device, equipment and readable storage medium | |
| CN113778864B (en) | A test case generation method and device, electronic device and storage medium | |
| US9356966B2 (en) | System and method to provide management of test data at various lifecycle stages | |
| CN111459796B (en) | Automated testing method, apparatus, computer device and storage medium | |
| US6269457B1 (en) | Technology regression and verification acceptance method | |
| CN114116496A (en) | Automated testing methods, devices, equipment and media | |
| CN110471945B (en) | Active data processing method, system, computer equipment and storage medium | |
| CN109800147B (en) | Test case generation method and terminal equipment | |
| CN119829469B (en) | Firmware testing method, electronic device, storage medium and program product | |
| CN118132448B (en) | Test case processing method, device, computer equipment and storage medium | |
| CN116228045B (en) | Method and device for evaluating weak links in product reliability based on performance degradation | |
| CN114238085A (en) | Interface testing method and device, computer equipment and storage medium | |
| CN117112305A (en) | Test data recovery method, device, equipment, medium and product | |
| CN111352824A (en) | Test method and device and computer equipment | |
| CN112559331A (en) | Test method and device | |
| JP2019144873A (en) | Block diagram analyzer | |
| US20230195609A1 (en) | Automatic generation of summary report for validation tests of computing systems | |
| CN117743169A (en) | Training method, device, equipment and storage medium for automatic test model | |
| CN116880927A (en) | Rule management method, device, computer equipment and storage medium | |
| CN119441041A (en) | Software testing method, device, computer equipment, readable storage medium and program product | |
| CN117909393A (en) | Interface parameter mapping acquisition method, device, equipment, medium and program product | |
| CN118132435A (en) | Test method, test device, computer equipment, readable storage medium and computer product | |
| CN119201588A (en) | Business system monitoring method, device and computer equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |