CN113282513B - Interface test case generation method and device, computer equipment and storage medium - Google Patents
Interface test case generation method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN113282513B CN113282513B CN202110720128.5A CN202110720128A CN113282513B CN 113282513 B CN113282513 B CN 113282513B CN 202110720128 A CN202110720128 A CN 202110720128A CN 113282513 B CN113282513 B CN 113282513B
- Authority
- CN
- China
- Prior art keywords
- interface
- test
- tested
- result
- test case
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
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 relates to the field of test case configuration, and discloses a method and a device for generating an interface test case, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring data information of an interface to be tested; identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type; identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rule, and generating an expected result of the interface to be tested according to the output parameters and the result rule; executing the test case through the interface to be tested to generate a test result of the interface to be tested; and if the test result is matched with the expected result, the information of the test case and the interface to be tested is relevant and written into a preset block chain network. The method and the device can improve the automatic generation efficiency of the test case.
Description
Technical Field
The present application relates to the field of test case configuration, and in particular, to a method and an apparatus for generating an interface test case, a computer device, and a storage medium.
Background
The current internet develops at a high speed, and the current interface test management tool still needs to compile cases manually, wastes much time on repeated work, is insufficient in automation, and results are compared mostly in a redundant manner, and are compared relatively singly, so that the efficiency is low.
Disclosure of Invention
The application mainly aims to provide a method and a device for generating an interface test case, computer equipment and a storage medium, and aims to solve the problems of low automation degree and low test case generation efficiency of the existing interface test tool.
In order to achieve the above object, the present application provides a method for generating an interface test case, including:
acquiring data information of an interface to be tested;
identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type;
identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rule, and generating an expected result of the interface to be tested according to the output parameters and the result rule;
executing the test case through the interface to be tested to generate a test result of the interface to be tested;
and if the test result is matched with the expected result, the information association between the test case and the interface to be tested is written into a preset block chain network.
Further, the identifying the classification type of the interface to be tested according to the data information includes:
identifying the incidence relation of the interface to be tested according to the data information;
and combining the interfaces to be tested based on the incidence relation to obtain a combined interface to be tested, and matching the combined interface to be tested with a corresponding classification type.
Further, after the associating and writing the information of the test case and the interface to be tested into a preset block chain network if the test result matches the expected result, the method further includes:
generating a test report with a preset format according to the test case and the test result;
and writing the information association between the test report and the interface to be tested into a preset block chain network.
Further, after the generating the test case of the interface to be tested according to the input parameters and the test rules, the method further includes:
receiving iterative information for the input parameters;
modifying input parameters in the test case according to the iteration information to obtain new output parameters;
and generating a new test case of the interface to be tested according to the new output parameters and the test rules.
Further, after the executing the test case through the interface to be tested and generating the test result of the interface to be tested, the method further includes:
if the test result is not matched with the expected result, configuring check points for each output parameter in the test case;
obtaining the test value of each output parameter from the test result according to the check point;
obtaining the expected value of each output parameter in the expected result;
comparing the test value with an expected value to obtain a comparison result;
and determining the abnormal output parameters in the test case according to the comparison result.
Further, after determining the abnormal output parameter according to the comparison result, the method further includes:
identifying an input parameter associated with the output parameter of the anomaly and a parameter type of the associated input parameter;
matching default parameters according to the parameter types;
and replacing the output parameters associated with the abnormal output parameters in the test case with the default parameters.
Further, the matching of the test rule and the result rule according to the classification type includes:
matching a test rule according to the classification type;
acquiring an application scene of the interface to be tested;
and matching result rules according to the classification types and the application scenes.
The present application further provides an interface test case generation apparatus, including:
the information acquisition module is used for acquiring data information of the interface to be tested;
the type identification module is used for identifying the classification type of the interface to be tested according to the data information and matching a test rule and a result rule according to the classification type;
the conversion output module is used for identifying the input parameters and the output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rules, and generating an expected result of the interface to be tested according to the output parameters and the result rules;
the test result module is used for executing the test case through the interface to be tested and generating a test result of the interface to be tested;
and the result comparison module is used for writing the information association between the test case and the interface to be tested into a preset block chain network if the test result is judged to be matched with the expected result.
The application also provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the interface test case generation method described in any one of the above when executing the computer program.
The present application further provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the method for generating an interface test case according to any one of the above-mentioned methods.
The application provides a method for automatically generating a test case, which comprises the steps of firstly obtaining data information of an interface to be tested, identifying a classification type of the interface to be tested according to the data information, matching a test rule and a result rule according to the classification type, identifying input parameters and output parameters of the interface to be tested from the data information, generating the test case of the interface to be tested according to the input parameters and the test rule, generating an expected result of the interface to be tested according to the output parameters and the result rule, executing the test case through the interface to be tested, generating a test result of the interface to be tested, determining the correctness of the test case when the test result of the interface to be tested is matched with the expected result, so that the test case can be correctly executed, completing the generation of the test case of the interface to be tested, improving the automatic generation efficiency of the test case, and then associating and writing the test case and the information of the interface to be tested into a preset block chain network, so that various items of data of the test case can be conveniently traced, ensuring that the interface is tested and the test result are not easily tampered, and improving the safety of the data.
Drawings
FIG. 1 is a schematic flow chart illustrating an embodiment of a method for generating interface test cases according to the present application;
FIG. 2 is a schematic structural diagram of an exemplary embodiment of an apparatus for generating interface test cases according to the present application;
FIG. 3 is a block diagram illustrating a computer device according to an embodiment of the present invention.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, an embodiment of the present application provides a method for generating an interface test case, which includes steps S10 to S50, and the steps of the method for generating an interface test case are described in detail as follows.
And S10, acquiring data information of the interface to be tested.
The embodiment is applied to an automatic interface case generation scene, and the interface is accessed to the automatic interface case generation tool by constructing the automatic interface case generation tool when the interface needs to be tested, so that the data information of the interface to be tested is obtained, wherein the data information comprises the type of the interface and the parameter configuration of the interface, and the parameter configuration comprises access parameter configuration and output parameter configuration, the type of the test case and a generation mode of an expected result.
S20, identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type.
In this embodiment, after data information of an interface to be tested is acquired, classification types of the interface to be tested are identified according to the data information, different types of interfaces need to be tested, and meanwhile, different types of interfaces need to be tested in different ways, and result comparison ways of the interfaces in different classification types are also different, so that different test rules and result rules are allocated to the interfaces to be tested in different classification types, how to test the interfaces in different classification types is the test rules, and how to generate the results of the interfaces in different classification types and the comparison rules is the result rules.
S30, identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rules, and generating an expected result of the interface to be tested according to the output parameters and the result rules.
In this embodiment, after the classification type of the interface to be tested is identified, the input parameters and the output parameters of the interface to be tested need to be identified according to the data information, where the input parameters include an input parameter of the interface to be tested, each parameter type of the input parameter, each parameter length of the input parameter, whether each parameter of the input parameter is a mandatory item, an incidence relation between the input parameters, and the like, then a test case of the interface to be tested is generated according to the input parameters and the test rules, and corresponding test cases can be generated for different classification types of interfaces to be tested; in addition, the output parameters include the parameters, each parameter type of the parameters, each parameter data source (input parameters, output parameters of other interfaces, database, random number, etc.) of the parameters, and the matching relationship of codes of the parameters, and then the expected result of the interface to be tested is generated according to the output parameters and the result rule, i.e. the expected and obtainable result of the interface to be tested is generated.
S40, executing the test case through the interface to be tested, and generating a test result of the interface to be tested.
In this embodiment, after a test case of the to-be-tested interface is generated according to the input parameters and the test rules, the test case is executed through the to-be-tested interface, a test environment is first established, and then each test case is executed through the to-be-tested interface in the test environment, where the test case is determined by the input parameters and the test rules of the to-be-tested interface, so that a test result of the to-be-tested interface associated with the input parameters and the test rules is generated according to the test case, and the test result is output according to the to-be-tested interface after the test case is executed.
And S50, if the test result is matched with the expected result, the information of the test case and the interface to be tested is relevant and written into a preset block chain network.
In this embodiment, when the test result of the interface to be tested matches the expected result, which indicates that the interface to be tested can be correctly executed, the correctness of the test case is determined, so that the generation of the test case of the interface to be tested is completed, the automatic generation efficiency of the test case is improved, and the information of the test case and the interface to be tested is written into the preset block chain network in an associated manner, so that each item of data of the test case is conveniently traced, the test case and the test result of the interface are ensured not to be easily tampered, and the safety of the data is improved.
The embodiment provides a method for automatically generating a test case, which includes the steps of firstly obtaining data information of an interface to be tested, identifying a classification type of the interface to be tested according to the data information, matching a test rule and a result rule according to the classification type, identifying input parameters and output parameters of the interface to be tested from the data information, generating the test case of the interface to be tested according to the input parameters and the test rule, generating an expected result of the interface to be tested according to the output parameters and the result rule, executing the test case through the interface to be tested, generating a test result of the interface to be tested, determining the correctness of the test case when the test result of the interface to be tested is matched with the expected result, so that the test case of the interface to be tested can be correctly executed, completing the generation of the test case of the interface to be tested, improving the automatic generation efficiency of the test case, and then associating and writing the test case and the information of the interface to be tested into a preset block chain network, so that various data of the test case can be conveniently tampered, and interface test and the test result are not easy to be generated, and the safety of data is improved.
In one embodiment, the identifying the classification type of the interface to be tested according to the data information includes:
identifying the incidence relation of the interface to be tested according to the data information;
and combining the interfaces to be tested based on the incidence relation to obtain a combined interface to be tested, and matching the combined interface to be tested with a corresponding classification type.
In this embodiment, when the classification type of the to-be-tested interface is identified according to the data information, some interfaces to be tested need to be subjected to a single-interface test, some interfaces to be tested need to be subjected to a combined test of a plurality of interfaces, at this time, the association relationship of the to-be-tested interfaces is identified according to the data information, the to-be-tested interfaces are combined based on the association relationship to obtain a combined to-be-tested interface, and the to-be-tested interfaces having the association relationship are combined, so that the combined to-be-tested interface can be tested together subsequently, the combined to-be-tested interface is matched with a corresponding classification type, the combined to-be-tested interface is used as a new to-be-tested interface, and the classification type is matched for the combined to-be-tested interface, thereby performing the combined test on the combined to-be-tested interface, and improving the efficiency of testing the combined interface.
In an embodiment, after the associating and writing the information of the test case and the interface to be tested into a preset blockchain network if the test result matches the expected result, the method further includes:
generating a test report with a preset format according to the test case and the test result;
and writing the test report and the to-be-tested interface into a preset block chain network in an associated manner.
In this embodiment, after the test result is judged to be matched with the expected result, the correctness of the test case is determined, and meanwhile, a test report in a preset format is generated according to the test case and the test result, where the test report indicates various pieces of information of the interface to be tested, such as entry information, exit information, test purposes, and the like, so as to facilitate reading of the test report of the test case of the interface to be tested, and then the test report and the information of the interface to be tested are written into a preset block chain network in an associated manner, so as to ensure the association between the interface to be tested and the test case and the test report, thereby ensuring data tracing and improving the integrity of the test interface case.
In one embodiment, after the generating the test case of the interface to be tested according to the input parameters and the test rules, the method further includes:
receiving iterative information for the input parameters;
modifying input parameters in the test case according to the iteration information to obtain new output parameters;
and generating a new test case of the interface to be tested according to the new output parameters and the test rules.
In this embodiment, after the test cases of the interfaces to be tested are generated according to the input parameters and the test rules, the test cases need to be iterated continuously to test the interfaces in different environments, specifically, iteration information of the input parameters is received, the iteration information includes modification information of the input parameters, all data of each input parameter converted from input to output is recorded in the test cases, then the input parameters in the test cases are modified according to the iteration information to obtain new output parameters, new test cases of the interfaces to be tested are generated according to the new output parameters and the test rules, and generation efficiency of the test cases in different scenarios is improved.
In an embodiment, after the executing the test case through the interface to be tested and generating the test result of the interface to be tested, the method further includes:
if the test result is not matched with the expected result, configuring check points for each output parameter in the test case;
obtaining the test value of each output parameter from the test result according to the check point;
obtaining the expected value of each output parameter in the expected result;
comparing the test value with an expected value to obtain a comparison result;
and determining the abnormal output parameters in the test case according to the comparison result.
In this embodiment, after the test case is executed through the interface to be tested, a test result of the interface to be tested is generated, whether the test result is matched with the expected result is judged, if the test result is not matched with the expected result, check points are configured for each output parameter in the test case, that is, check points are configured for each output parameter in the test case, and are used for recording data of each output parameter, then a test value of each output parameter is obtained from the test result according to the check points, an expected value of each output parameter in the expected result is obtained, the test value is compared with the expected value, a comparison result is obtained, the output parameter of which the test value is not matched with the expected value is found, the output parameter is determined to be an abnormal output parameter, the abnormal output parameter is determined according to the comparison result, the abnormal parameter is rapidly found, and the comparison of each output parameter is performed only on the premise that the comparison of the overall result is not matched, so that the efficiency of finding the abnormality of the test case is improved.
In one embodiment, after determining the abnormal output parameter according to the comparison result, the method further includes:
identifying an input parameter associated with the output parameter of the anomaly and a parameter type of the associated input parameter;
matching default parameters according to the parameter types;
and replacing the output parameters associated with the abnormal output parameters in the test case with the default parameters.
In this embodiment, after determining the abnormal output parameter according to the comparison result, the input parameter associated with the abnormal output parameter is identified, that is, the output parameter is obtained by commonly calculating which input parameters, the parameter type of the associated input parameter is identified, different parameter types are configured with different default parameters, the default parameter is matched according to the parameter type, the output parameter associated with the abnormal output parameter in the test case is replaced with the default parameter, and the default parameter can ensure normal operation of the test case, and further confirm the correctness of the abnormal output parameter.
In one embodiment, the matching test rules and result rules according to the classification type includes:
matching a test rule according to the classification type;
acquiring an application scene of the interface to be tested;
and matching result rules according to the classification types and the application scenes.
In this embodiment, since the comparison rules for the test results of the interfaces to be tested are different in different test scenarios, when the test rules and the result rules are matched according to the classification type, the test rules are still matched according to the classification type, then the application scenarios of the interfaces to be tested are obtained, where the application scenarios include development version test application scenarios, production version test application scenarios, and the like, and then the result rules are matched according to the classification type and the application scenarios, different result rules are matched in different scenarios, such as development version test application scenarios, and the comparison rules in the result rules include data comparison and concurrent comparison; in a production version test application scene, the comparison rule in the result rule comprises data comparison, concurrent comparison, activity comparison and average value comparison, so that the requirements of test cases under different test scenes are met, and the application universality of the scene generated by the test cases is improved.
Referring to fig. 2, the present application further provides an interface test case generation apparatus, including:
the information acquisition module 10 is used for acquiring data information of the interface to be tested;
the type identification module 20 is configured to identify a classification type of the interface to be tested according to the data information, and match a test rule and a result rule according to the classification type;
the conversion output module 30 is configured to identify an input parameter and an output parameter of the interface to be tested from the data information, generate a test case of the interface to be tested according to the input parameter and the test rule, and generate an expected result of the interface to be tested according to the output parameter and the result rule;
the test result module 40 is configured to execute the test case through the interface to be tested, and generate a test result of the interface to be tested;
and a result comparing module 50, configured to, if it is determined that the test result matches the expected result, associate and write the information of the test case and the to-be-tested interface into a preset block chain network.
As described above, it can be understood that the components of the interface test case generation apparatus proposed in the present application can implement the functions of any one of the above interface test case generation methods.
In one embodiment, the type identification module 20 further performs:
identifying the incidence relation of the interface to be tested according to the data information;
and combining the interfaces to be tested based on the incidence relation to obtain a combined interface to be tested, and matching the combined interface to be tested with a corresponding classification type.
In one embodiment, the apparatus further comprises a test reporting module to perform:
generating a test report with a preset format according to the test case and the test result;
and writing the information association between the test report and the interface to be tested into a preset block chain network.
In one embodiment, the apparatus further comprises an iteration module for performing:
receiving iterative information for the input parameters;
modifying input parameters in the test case according to the iteration information to obtain new output parameters;
and generating a new test case of the interface to be tested according to the new output parameters and the test rules.
In one embodiment, the apparatus further comprises an anomaly comparison module configured to perform:
if the test result is judged not to be matched with the expected result, configuring check points for each output parameter in the test case;
obtaining the test value of each output parameter from the test result according to the check point;
obtaining the expected value of each output parameter in the expected result;
comparing the test value with an expected value to obtain a comparison result;
and determining the abnormal output parameters in the test case according to the comparison result.
In one embodiment, the apparatus further comprises an alternative modification module configured to perform:
identifying an input parameter associated with the output parameter of the anomaly and a parameter type of the associated input parameter;
matching default parameters according to the parameter types;
and replacing the output parameters associated with the abnormal output parameters in the test case with the default parameters.
In one embodiment, the type identification module 30 further performs:
matching a test rule according to the classification type;
acquiring an application scene of the interface to be tested;
and matching result rules according to the classification types and the application scenes.
Referring to fig. 3, a computer device, which may be a mobile terminal and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer equipment comprises a processor, a memory, a network interface, a display device and an input device which are connected through a system bus. Wherein, the network interface of the computer equipment is used for communicating with an external terminal through network connection. The input means of the computer device is for receiving input from a user. The computer designed processor is used to provide computational and control capabilities. The memory of the computer device includes a storage medium. The storage medium stores an operating system, a computer program, and a database. The database of the computer device is used for storing data. The computer program is executed by a processor to implement a method of generating interface test cases.
The processor executes the method for generating the interface test case, and the method comprises the following steps: acquiring data information of an interface to be tested; identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type; identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rule, and generating an expected result of the interface to be tested according to the output parameters and the result rule; executing the test case through the interface to be tested to generate a test result of the interface to be tested; and if the test result is matched with the expected result, the information of the test case and the interface to be tested is relevant and written into a preset block chain network.
The computer equipment provides a method for automatically generating a test case, firstly, data information of an interface to be tested is obtained, a classification type of the interface to be tested is identified according to the data information, a test rule and a result rule are matched according to the classification type, input parameters and output parameters of the interface to be tested are identified from the data information, the test case of the interface to be tested is generated according to the input parameters and the test rule, an expected result of the interface to be tested is generated according to the output parameters and the result rule, then the test case is executed through the interface to be tested, a test result of the interface to be tested is generated, when the test result of the interface to be tested is matched with the expected result, the interface to be tested can be correctly executed, the correctness of the test case is determined at the moment, the generation of the test of the interface to be tested is completed, the automatic generation efficiency of the test case is improved, and then the information of the test case and the interface to be tested is related and written into a preset block chain network, so that the data of the test case can be conveniently traced, the interface test and the test result is not easily tampered, and the safety of the data is improved.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by the processor, implements a method for generating an interface test case, and the method includes: acquiring data information of an interface to be tested; identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type; identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rule, and generating an expected result of the interface to be tested according to the output parameters and the result rule; executing the test case through the interface to be tested to generate a test result of the interface to be tested; and if the test result is matched with the expected result, the information of the test case and the interface to be tested is relevant and written into a preset block chain network.
The computer readable storage medium provides a method for automatically generating a test case, firstly, data information of an interface to be tested is obtained, a classification type of the interface to be tested is identified according to the data information, a test rule and a result rule are matched according to the classification type, input parameters and output parameters of the interface to be tested are identified from the data information, the test case of the interface to be tested is generated according to the input parameters and the test rule, an expected result of the interface to be tested is generated according to the output parameters and the result rule, then, the test case is executed through the interface to be tested, a test result of the interface to be tested is generated, when the test result of the interface to be tested is matched with the expected result, the interface to be tested can be correctly executed, at the moment, the correctness of the test case is determined, the generation of the test case of the interface to be tested is completed, the automatic generation efficiency of the test is improved, and then, the information of the test case and the interface to be tested are associated and written into a preset block chain network, so that the data of the test case can be conveniently traced, various interface to be tested and the test result is not easily tampered.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above.
Any reference to memory, storage, database, or other medium provided herein and used in the embodiments may include non-volatile and/or volatile memory.
Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM).
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, apparatus, article, or method that comprises the element.
The above description is only a preferred embodiment of the present application and is not intended to limit the scope of the present application.
All the equivalent structures or equivalent processes performed by using the contents of the specification and the drawings of the present application, or directly or indirectly applied to other related technical fields, are included in the scope of protection of the present application.
Claims (9)
1. A method for generating an interface test case is characterized by comprising the following steps:
acquiring data information of an interface to be tested;
identifying the classification type of the interface to be tested according to the data information, and matching a test rule and a result rule according to the classification type;
identifying input parameters and output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rule, and generating an expected result of the interface to be tested according to the output parameters and the result rule;
executing the test case through the interface to be tested to generate a test result of the interface to be tested;
if the test result is matched with the expected result, the information of the test case and the interface to be tested is relevant and written into a preset block chain network;
if the test result is not matched with the expected result, configuring check points for each output parameter in the test case;
obtaining the test value of each output parameter from the test result according to the check point;
obtaining an expected value of each output parameter in the expected result;
comparing the test value with the expected value to obtain a comparison result;
and determining the output parameters with abnormality in the test case according to the comparison result.
2. The method for generating interface test cases according to claim 1, wherein the identifying the classification type of the interface to be tested according to the data information comprises:
identifying the incidence relation of the interface to be tested according to the data information;
and combining the interfaces to be tested based on the incidence relation to obtain a combined interface to be tested, and matching the combined interface to be tested with a corresponding classification type.
3. The method for generating an interface test case according to claim 1, wherein after the associating and writing the information of the test case and the interface to be tested into a predetermined blockchain network if the test result matches the expected result, the method further comprises:
generating a test report with a preset format according to the test case and the test result;
and writing the information association between the test report and the interface to be tested into a preset block chain network.
4. The method for generating interface test cases according to claim 1, wherein after generating the test cases of the interfaces to be tested according to the input parameters and the test rules, the method further comprises:
receiving iterative information for the input parameters;
modifying input parameters in the test case according to the iteration information to obtain new output parameters;
and generating a new test case of the interface to be tested according to the new output parameters and the test rules.
5. The method for generating an interface test case according to claim 1, wherein after determining the output parameter with abnormality according to the comparison result, the method further comprises:
identifying an input parameter associated with the output parameter of the anomaly and a parameter type of the associated input parameter;
matching default parameters according to the parameter types;
and replacing the output parameters associated with the abnormal output parameters in the test case with the default parameters.
6. The method for generating interface test cases according to claim 1, wherein the matching test rules and result rules according to the classification types comprises:
matching a test rule according to the classification type;
acquiring an application scene of the interface to be tested;
and matching result rules according to the classification types and the application scenes.
7. An apparatus for generating interface test cases, comprising:
the information acquisition module is used for acquiring data information of the interface to be tested;
the type identification module is used for identifying the classification type of the interface to be tested according to the data information and matching a test rule and a result rule according to the classification type;
the conversion output module is used for identifying the input parameters and the output parameters of the interface to be tested from the data information, generating a test case of the interface to be tested according to the input parameters and the test rules, and generating an expected result of the interface to be tested according to the output parameters and the result rules;
the test result module is used for executing the test case through the interface to be tested and generating a test result of the interface to be tested;
the result comparison module is used for writing the information association between the test case and the interface to be tested into a preset block chain network if the test result is judged to be matched with the expected result; if the test result is not matched with the expected result, configuring check points for each output parameter in the test case; obtaining the test value of each output parameter from the test result according to the check point; obtaining an expected value of each output parameter in the expected result; comparing the test value with the expected value to obtain a comparison result; and determining the output parameters with abnormality in the test case according to the comparison result.
8. A computer arrangement comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, carries out the steps of the method for generating interface test cases according to any one of claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for generating interface test cases of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110720128.5A CN113282513B (en) | 2021-06-28 | 2021-06-28 | Interface test case generation method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110720128.5A CN113282513B (en) | 2021-06-28 | 2021-06-28 | Interface test case generation method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113282513A CN113282513A (en) | 2021-08-20 |
CN113282513B true CN113282513B (en) | 2022-11-29 |
Family
ID=77285852
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110720128.5A Active CN113282513B (en) | 2021-06-28 | 2021-06-28 | Interface test case generation method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113282513B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115695267B (en) * | 2022-10-28 | 2024-05-03 | 北京鼎泰智源科技有限公司 | Data interface-oriented testing and verifying method and device |
CN116627851B (en) * | 2023-07-24 | 2023-10-20 | 恒生电子股份有限公司 | Interface testing method and device |
CN116932403B (en) * | 2023-07-25 | 2024-06-11 | 太初(无锡)电子科技有限公司 | Test case generation method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110502442A (en) * | 2019-08-15 | 2019-11-26 | 平安普惠企业管理有限公司 | Dynamic parameter method of calibration, device, equipment and storage medium |
CN111459812A (en) * | 2020-03-30 | 2020-07-28 | 招商局金融科技有限公司 | Interface test case generation method, electronic device and storage medium |
CN112612706A (en) * | 2020-12-25 | 2021-04-06 | 深圳市彬讯科技有限公司 | Automated testing method, computer device and storage medium |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012059026A (en) * | 2010-09-09 | 2012-03-22 | Hitachi Ltd | Source code conversion method and source code conversion program |
CN108614770B (en) * | 2018-04-09 | 2021-08-27 | 中国工商银行股份有限公司 | Automatic test assertion method, device, storage medium and equipment |
US10698792B2 (en) * | 2018-05-02 | 2020-06-30 | Microsoft Technology Licensing, Llc | Execution control with cross-level trace mapping |
CN109766264A (en) * | 2018-12-15 | 2019-05-17 | 深圳壹账通智能科技有限公司 | Method of calibration, device, computer equipment and the storage medium of interface parameters |
CN112000566B (en) * | 2019-05-27 | 2023-11-28 | 腾讯科技(深圳)有限公司 | Method and device for generating test cases |
CN110471842A (en) * | 2019-07-12 | 2019-11-19 | 平安普惠企业管理有限公司 | A kind of test method, device and computer readable storage medium |
CN110647471B (en) * | 2019-09-26 | 2023-05-23 | 招商局金融科技有限公司 | Interface test case generation method, electronic device and storage medium |
CN112527630B (en) * | 2020-11-18 | 2023-07-07 | 平安消费金融有限公司 | Test case generation method, device, computer equipment and storage medium |
-
2021
- 2021-06-28 CN CN202110720128.5A patent/CN113282513B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110502442A (en) * | 2019-08-15 | 2019-11-26 | 平安普惠企业管理有限公司 | Dynamic parameter method of calibration, device, equipment and storage medium |
CN111459812A (en) * | 2020-03-30 | 2020-07-28 | 招商局金融科技有限公司 | Interface test case generation method, electronic device and storage medium |
CN112612706A (en) * | 2020-12-25 | 2021-04-06 | 深圳市彬讯科技有限公司 | Automated testing method, computer device and storage medium |
Non-Patent Citations (1)
Title |
---|
基于XML描述校验规则的数据输入测试用例自动生成方法;姚庚梅等;《科技信息》;20100725(第21期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113282513A (en) | 2021-08-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113282513B (en) | Interface test case generation method and device, computer equipment and storage medium | |
CN108427613B (en) | Abnormal interface positioning method and device, computer equipment and storage medium | |
CN110941546A (en) | Automatic test method, device, equipment and storage medium for WEB page case | |
CN112559365A (en) | Test case screening method and device, computer equipment and storage medium | |
CN110231937B (en) | Script defect scanning method, script defect scanning device, computer equipment and storage medium | |
CN109766261B (en) | Coverage test method, coverage test device, computer equipment and storage medium | |
CN112559364B (en) | Test case generation method and device, computer equipment and storage medium | |
CN113656404A (en) | Data verification method and device, computer equipment and storage medium | |
CN111459796B (en) | Automated testing method, apparatus, computer device and storage medium | |
CN112395202B (en) | Interface automation test method and device, computer equipment and storage medium | |
CN111124870A (en) | Interface testing method and device | |
CN111897727A (en) | Software testing method and device, computer equipment and storage medium | |
CN111581076A (en) | System code testing method and device, computer equipment and storage medium | |
CN111444093B (en) | Method and device for determining quality of project development process and computer equipment | |
CN113886262A (en) | Software automation test method and device, computer equipment and storage medium | |
CN112527286A (en) | Service code generation method and device, computer equipment and storage medium | |
CN114610635A (en) | Interface test case generation method and device, computer equipment and storage medium | |
EP3514680A1 (en) | Identification of changes in functional behavior and runtime behavior of a system during maintenance cycles | |
CN112463620B (en) | Coverage rate test method and device in android software integration test | |
CN117391306A (en) | Homeland space planning result examination method, device, equipment and storage medium | |
CN112346981A (en) | Joint debugging test coverage rate detection method and system | |
CN112612706A (en) | Automated testing method, computer device and storage medium | |
CN116521538A (en) | Automatic testing method and device for command line interface, electronic equipment and storage medium | |
CN114996160A (en) | Test method, system and storage medium | |
CN112612882B (en) | Review report generation method, device, equipment and storage medium |
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 |