Interface testing method and device

By creating use case sets and interface bindings, and creating parameter groups for the interface on the interface editing page, batch testing of interface test cases is implemented, solving the problem of low interface testing efficiency in the existing technology and improving testing efficiency.

CN112181845BActive Publication Date: 2024-12-13HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011090142.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-13
Publication Date
2024-12-13
Estimated Expiration
2040-10-13

AI Technical Summary

Technical Problem

Existing interface testing tools do not support batch testing of interfaces, resulting in low testing efficiency when there are a large number of interfaces that need to be tested.

Method used

By creating a use case set and binding interface, creating parameter groups for the interface in different business scenarios on the interface editing page, and executing the use case set or interface test cases, the creation and management of interface test cases from the use case set dimension and interface dimension. Supports batch testing.

Benefits of technology

It improves the efficiency of interface testing, and can batch test interface test cases in use case set dimensions or interface dimensions, significantly improving testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181845B_ABST
    Figure CN112181845B_ABST
Patent Text Reader

Abstract

The present invention provides an interface testing method and device. First, at least one use case set is created according to the test requirements. After the interface is created, the interface is bound to the at least one use case set, each use case set corresponds to at least one interface, and then parameter groups under different business scenarios are created for the interface on the interface editing page, each parameter group corresponds to an interface test case, that is, each interface corresponds to multiple interface test cases under different business scenarios, thereby realizing the creation and management of interface test cases from the use case set dimension and the interface dimension, and then the interface test cases of all interfaces under the use case set or all interface test cases under the interface dimension can be batch tested in the use case set dimension, thereby improving the interface testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of interface testing, and more specifically, to an interface testing method and device. Background Art

[0002] Interface testing is a test of the interface between system components. It is mainly used to test the interface between the system and other external systems, as well as the interface between various sub-modules within the system. The focus of the test is to check the correctness of interface parameter transmission, the correctness of interface function implementation, and the correctness of output results.

[0003] Existing interface testing tools, such as Postman, Yapi, etc., can provide visual interface request editing pages and debugging pages. However, existing interface testing tools do not support batch testing of interfaces. When there are a large number of interfaces to be tested, the testing efficiency is low. Summary of the invention

[0004] In view of this, the present invention provides an interface testing method and device to implement batch testing in the use case set dimension and improve the interface testing efficiency.

[0005] In order to achieve the above-mentioned invention object, the specific technical solution provided by the present invention is as follows:

[0006] An interface testing method, comprising:

[0007] Create at least one test case set based on the test requirements;

[0008] Creating an interface, and binding the interface to at least one of the use case sets, each of the use case sets corresponding to at least one of the interfaces;

[0009] On the interface editing page, create parameter groups for different business scenarios for the interface, each of which corresponds to an interface test case;

[0010] Execute the interface test cases of all the interfaces under the use case set or execute all interface test cases corresponding to the interfaces.

[0011] Optionally, the input parameter types of the parameter group include static key-value pair input parameters, interface response dynamic parsing input parameters, extension function input parameters, global variable input parameters and auxiliary calculation field input parameters.

[0012] Optionally, on the interface editing page, creating parameter groups for different business scenarios for the interface includes:

[0013] On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group;

[0014] Setting a test scenario description for the interface, wherein the test scenario description is used to describe a business scenario of the parameter group test;

[0015] Setting a pre-processing operation for the interface, wherein the pre-processing operation is executed through an interface call before executing the interface test case;

[0016] Setting a request header and request parameters for the interface, wherein the request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables or auxiliary calculated fields;

[0017] Configure assertions for the interface. The assertion types include string assertion, json structure + field combination assertion, jsonp prefix + json structure + field combination assertion;

[0018] A post-processing operation is set for the interface, and the post-processing operation is executed through an interface call after the interface test case is executed.

[0019] Optionally, on the interface editing page, creating parameter groups for different business scenarios for the interface includes:

[0020] On the interface editing page, create parameter groups for different business scenarios for the interface;

[0021] Testing the interface test case;

[0022] If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface, and return to test the interface test case after the defect is fixed until the return value of the interface meets expectations and the assertion passes in the test results of the interface test case.

[0023] Optionally, the method further includes:

[0024] In the event that the interface test case fails to execute, determining the assertion type corresponding to the interface test case;

[0025] Asserting the interface test case according to the assertion configuration of the assertion type corresponding to the interface test case;

[0026] Add the reason for the assertion failure to the failure reason list of the interface test case;

[0027] Feedback the failure reason list of the interface test case to the front end for display.

[0028] Optionally, the method further includes:

[0029] In the process of executing the interface test cases of all the interfaces under the use case set, obtaining the use case execution record, the interface execution record and the use case set execution record;

[0030] The use case execution record, the interface execution record and the use case set execution record are stored in corresponding data tables.

[0031] An interface testing device, comprising:

[0032] A use case set creation unit, used to create at least one use case set according to the test requirements;

[0033] An interface creation unit, used to create an interface and bind the interface to at least one of the use case sets, each of the use case sets corresponding to at least one of the interfaces;

[0034] A parameter group creation unit, used to create parameter groups under different business scenarios for the interface on the interface editing page, each parameter group corresponding to an interface test case;

[0035] A use case set execution unit, used to execute interface test cases of all the interfaces under the use case set;

[0036] The interface execution unit is used to execute all interface test cases corresponding to the interface.

[0037] Optionally, the input parameter types of the parameter group include static key-value pair input parameters, interface response dynamic parsing input parameters, extension function input parameters, global variable input parameters and auxiliary calculation field input parameters.

[0038] Optionally, the parameter group creation unit is specifically used to:

[0039] On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group;

[0040] Setting a test scenario description for the interface, wherein the test scenario description is used to describe a business scenario of the parameter group test;

[0041] Setting a pre-processing operation for the interface, wherein the pre-processing operation is executed through an interface call before executing the interface test case;

[0042] Setting a request header and request parameters for the interface, wherein the request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables or auxiliary calculated fields;

[0043] Configure assertions for the interface. The assertion types include string assertion, json structure + field combination assertion, jsonp prefix + json structure + field combination assertion;

[0044] A post-processing operation is set for the interface, and the post-processing operation is executed through an interface call after the interface test case is executed.

[0045] Optionally, the parameter group creation unit is specifically used to:

[0046] On the interface editing page, create parameter groups for different business scenarios for the interface;

[0047] Testing the interface test case;

[0048] If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface, and return to test the interface test case after the defect is fixed until the return value of the interface meets expectations and the assertion passes in the test results of the interface test case.

[0049] Optionally, the device further comprises a failure cause determination unit;

[0050] The failure cause determination unit is specifically used to:

[0051] In the event that the interface test case fails to execute, determining the assertion type corresponding to the interface test case;

[0052] Asserting the interface test case according to the assertion configuration of the assertion type corresponding to the interface test case;

[0053] Add the reason for the assertion failure to the failure reason list of the interface test case;

[0054] Feedback the failure reason list of the interface test case to the front end for display.

[0055] Optionally, the device further comprises an execution record storage unit;

[0056] The execution record storage unit is specifically used for:

[0057] In the process of executing the interface test cases of all the interfaces under the use case set, obtaining the use case execution record, the interface execution record and the use case set execution record;

[0058] The use case execution record, the interface execution record and the use case set execution record are stored in corresponding data tables.

[0059] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0060] The present invention discloses an interface testing method, which first creates at least one use case set according to test requirements, binds the interface to at least one use case set after the interface is created, each use case set corresponds to at least one interface, and then creates parameter groups under different business scenarios for the interface on an interface editing page, each parameter group corresponds to an interface test case, that is, each interface corresponds to multiple interface test cases under different business scenarios, thereby realizing the creation and management of interface test cases from the use case set dimension and the interface dimension, and then batch testing can be performed on the interface test cases of all interfaces under the use case set or all interface test cases under the interface dimension in the use case set dimension, thereby improving the interface testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0062] Figure 1 A flowchart of an interface testing method disclosed in an embodiment of the present invention;

[0063] Figure 2 A schematic diagram of a process for creating a parameter group disclosed in an embodiment of the present invention;

[0064] Figure 3 A schematic diagram of an interface editing page disclosed in an embodiment of the present invention;

[0065] Figure 4 The present invention is a schematic diagram of the structure of an interface testing device disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0066] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] The present invention discloses an interface testing method, which realizes the creation and management of interface testing cases from the use case set dimension and the interface dimension, and further can perform batch testing on the interface testing cases of all interfaces under the use case set in the use case set dimension, thereby improving the interface testing efficiency.

[0068] For details, please refer to Figure 1, an interface testing method disclosed in this embodiment includes the following steps:

[0069] S101: Create at least one use case set according to the test requirements;

[0070] Each test requirement corresponds to a use case set, which enables group test management of different business requirements.

[0071] S102: Create an interface and bind the interface to at least one use case set, where each use case set corresponds to at least one interface;

[0072] The interface is the interface being tested. One interface corresponds to at least one use case set, and one use case set corresponds to at least one interface.

[0073] The creation of an interface does not depend on the creation of a use case set. After the interface is created, it can be temporarily unbound to the use case set, and can be bound in real time according to test requirements later.

[0074] S103: On the interface editing page, create parameter groups for different business scenarios for the interface, each parameter group corresponding to an interface test case;

[0075] The configuration data contained in the parameter group includes: parameter group name, test scenario description, pre-processing operation, request header and request parameters, assertion configuration and post-processing operation.

[0076] For details, please refer to Figure 2 , the parameter group creation method includes the following steps:

[0077] S201: On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group;

[0078] An example of an interface editing page is as follows: Figure 3 As shown, the interface creation and configuration can be realized on the interface editing page. When creating an interface, it is necessary to configure the basic information of the interface, parameter group information, and assertion information corresponding to each parameter group.

[0079] Users can identify the test purpose of a test case through the parameter group name.

[0080] S202: Setting a test scenario description for the interface, where the test scenario description is used to describe a business scenario for a parameter group test;

[0081] S203: setting a pre-processing operation for the interface, the pre-processing operation is executed through an interface call before executing the interface test case;

[0082] The pre-processing operation of the interface is the operation to be performed before executing the test case.

[0083] The pre-processing operation of the interface can be one or more, and each pre-processing operation is executed through an interface call.

[0084] S204: Setting a request header and request parameters for the interface. The request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables, or auxiliary calculated fields;

[0085] Specifically, you can configure the request headers and request parameters of get and post requests.

[0086] Request parameters can be set as static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables, auxiliary calculated fields, etc.

[0087] Among them, static key-value pair input parameters are fixed key-value pairs input by users. The format of the key-value pair is key-value. Static key-value pairs are not changeable.

[0088] Interface response dynamic parsing input parameters means that the input parameters of the current interface (i.e., input parameters) are parsed from the output parameters (i.e., output parameters) of another interface.

[0089] The input parameters of the extension function are a set of specific functions that have been defined in the platform backend. Through the Java reflection mechanism, the method and parameter list passed in by the user are executed to obtain the parameter values.

[0090] Global variable input means that the initialization is completed once each time a use case set, interface or interface use case is executed. When the interface inputs the parameter, the initialized value is always used.

[0091] The auxiliary calculation field input parameter is only used to assist the dynamic calculation of other request parameters and is not passed in during the actual request.

[0092] S205: configure assertions for the interface. The assertion types include string assertions, json structure + field combination assertions, and jsonp prefix + json structure + field combination assertions.

[0093] The above three types of assertions can be used in different assertion scenarios, and the assertion strength increases successively.

[0094] You can compress and format the json string to facilitate the display of assertion configuration.

[0095] S206: Setting a post-processing operation for the interface, the post-processing operation is executed through the interface call after the interface test case is executed.

[0096] The post-processing operation of the interface is the operation to be performed after the test case is executed.

[0097] The post-processing operation of the interface can be one or more, and each operation is executed through an interface call.

[0098] Furthermore, in order to improve the efficiency of creating parameter groups, parameter groups can be quickly copied or created through parameter group copying.

[0099] Furthermore, on the interface editing page, create parameter groups for the interface under different business scenarios, test the interface test cases, and on the test response result display page, you can see whether the return value of the interface meets expectations based on the response result. On this display page, you can use shortcut keys to clear the response result or return to the top of the page. If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface. After the defect is fixed, return to test the interface test case until the return value of the interface in the test result of the interface test case meets expectations and the assertion passes.

[0100] After all the test cases of the interface are created in sequence through the above method, you can execute the interface to determine the execution status of all test cases. If all are executed successfully, you can start designing the use case of the next interface to be tested. If some are not executed successfully, the user can view the interface execution record to locate which specific test case has a problem, and then debug the test case until all the test cases of the interface pass.

[0101] S104: Execute interface test cases of all interfaces under the use case set or execute all interface test cases corresponding to the interfaces.

[0102] After all interfaces are prepared, the use case set can be executed. Executing the use case set will execute all interfaces and interface test cases under the use case set. If all interface test cases corresponding to the use case set pass the test, a test report of the interface test passing can be sent, and the tested test cases can be bound to the automated use case set to facilitate the continuous integration of subsequent interface services.

[0103] In the event that the interface test case fails to execute, determine the assertion type corresponding to the interface test case; assert the interface test case according to the assertion type and assertion configuration corresponding to the interface test case; add the reason for the assertion failure to the failure reason list of the interface test case; feed back the failure reason list of the interface test case to the front-end for display, so that the failure reason of the interface test case can be traced later.

[0104] In the process of executing interface test cases of all interfaces under the use case set, you can obtain the use case execution records, interface execution records and use case set execution records.

[0105] Among them, the use case execution record refers to the request record generated by each parameter group of the interface request, which describes the interface request parameter data, response data, assertion results and failure cause analysis, etc.

[0106] The interface execution record refers to the data record generated after the interface executes all parameter groups managed under the interface, focusing on describing the execution results of the interface and the success rate of the use case execution.

[0107] The use case set execution record refers to the data record generated after the use case set executes all interfaces managed under the use case set, focusing on describing the execution results of the use case set and the success rate of interface execution.

[0108] On this basis, the use case execution records, interface execution records and use case set execution records can be stored in the corresponding data tables to facilitate the backtracking, tracking and analysis of test results.

[0109] It can be seen that an interface testing method disclosed in this embodiment first creates at least one use case set according to the test requirements. After the interface is created, the interface is bound to at least one use case set, each use case set corresponds to at least one interface, and then parameter groups under different business scenarios are created for the interface on the interface editing page. Each parameter group corresponds to an interface test case, that is, each interface corresponds to multiple interface test cases under different business scenarios, thereby realizing the creation and management of interface test cases from the use case set dimension and the interface dimension, and then the interface test cases of all interfaces under the use case set or all interface test cases under the interface dimension can be batch tested in the use case set dimension, thereby improving the interface testing efficiency.

[0110] Based on the interface testing method disclosed in the above embodiment, this embodiment correspondingly discloses an interface testing device. Figure 4 , the device comprises:

[0111] A use case set creating unit 301, configured to create at least one use case set according to test requirements;

[0112] An interface creation unit 302, configured to create an interface and bind the interface to at least one of the use case sets, each of the use case sets corresponding to at least one of the interfaces;

[0113] A parameter group creation unit 303 is used to create parameter groups under different business scenarios for the interface on the interface editing page, each of which corresponds to an interface test case;

[0114] A use case set execution unit 304, used to execute interface test cases of all the interfaces under the use case set;

[0115] The interface execution unit 305 is used to execute all interface test cases corresponding to the interface.

[0116] Optionally, the input parameter types of the parameter group include static key-value pair input parameters, interface response dynamic parsing input parameters, extension function input parameters, global variable input parameters and auxiliary calculation field input parameters.

[0117] Optionally, the parameter group creation unit is specifically used to:

[0118] On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group;

[0119] Setting a test scenario description for the interface, wherein the test scenario description is used to describe a business scenario of the parameter group test;

[0120] Setting a pre-processing operation for the interface, wherein the pre-processing operation is executed through an interface call before executing the interface test case;

[0121] Setting a request header and request parameters for the interface, wherein the request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables or auxiliary calculated fields;

[0122] Configure assertions for the interface. The assertion types include string assertion, json structure + field combination assertion, jsonp prefix + json structure + field combination assertion;

[0123] A post-processing operation is set for the interface, and the post-processing operation is executed through an interface call after the interface test case is executed.

[0124] Optionally, the parameter group creation unit is specifically used to:

[0125] On the interface editing page, create parameter groups for different business scenarios for the interface;

[0126] Testing the interface test case;

[0127] If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface, and return to test the interface test case after the defect is fixed until the return value of the interface meets expectations and the assertion passes in the test results of the interface test case.

[0128] Optionally, the device further comprises a failure cause determination unit;

[0129] The failure cause determination unit is specifically used to:

[0130] In the event that the interface test case fails to execute, determining the assertion type corresponding to the interface test case;

[0131] Asserting the interface test case according to the assertion configuration of the assertion type corresponding to the interface test case;

[0132] Add the reason for the assertion failure to the failure reason list of the interface test case;

[0133] Feedback the failure reason list of the interface test case to the front end for display.

[0134] Optionally, the device further comprises an execution record storage unit;

[0135] The execution record storage unit is specifically used for:

[0136] In the process of executing the interface test cases of all the interfaces under the use case set, obtaining the use case execution record, the interface execution record and the use case set execution record;

[0137] The use case execution record, the interface execution record and the use case set execution record are stored in corresponding data tables.

[0138] An interface testing device disclosed in this embodiment first creates at least one use case set according to test requirements. After the interface is created, the interface is bound to at least one use case set, each use case set corresponds to at least one interface, and then parameter groups under different business scenarios are created for the interface on the interface editing page, each parameter group corresponds to an interface test case, that is, each interface corresponds to multiple interface test cases under different business scenarios, thereby realizing the creation and management of interface test cases from the use case set dimension and the interface dimension, and then the interface test cases of all interfaces under the use case set or all interface test cases under the interface dimension can be batch tested in the use case set dimension, thereby improving the interface testing efficiency.

[0139] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0140] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0141] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0142] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An interface testing method, characterized in that: include: Create at least one test case set based on the test requirements; Create an interface, and bind the interface to at least one of the use case sets, each of the use case sets corresponds to at least one of the interfaces; wherein one interface corresponds to at least one use case set; after the interface is created, the use case set is subsequently bound in real time according to the test requirements; On the interface editing page, create parameter groups for different business scenarios for the interface, each of which corresponds to an interface test case; Execute interface test cases of all the interfaces under the use case set or execute all interface test cases corresponding to the interfaces; The parameter group input types include static key-value pair input, interface response dynamic parsing input, extension function input, global variable input, and auxiliary calculation field input. On the interface editing page, parameter groups for different business scenarios are created for the interface, including: On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group; Setting a test scenario description for the interface, wherein the test scenario description is used to describe a business scenario of the parameter group test; Setting a pre-processing operation for the interface, wherein the pre-processing operation is executed through an interface call before executing the interface test case; Setting a request header and request parameters for the interface, wherein the request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables or auxiliary calculated fields; Configure assertions for the interface. The assertion types include string assertion, json structure + field combination assertion, jsonp prefix + json structure + field combination assertion; Setting a post-processing operation for the interface, wherein the post-processing operation is executed through an interface call after executing the interface test case; The method further comprises: In the process of executing the interface test cases of all the interfaces under the use case set, obtaining the use case execution record, the interface execution record and the use case set execution record; wherein the use case execution record refers to the request record generated by the interface requesting each parameter group; the interface execution record refers to the data record generated after the interface executes all the parameter groups managed under the interface; by viewing the interface execution record, the test case with execution problems can be located to debug the test case until all the test cases of the interface pass the test; The use case set execution record refers to the data record generated after the use case set executes all interfaces managed under the use case set; The use case execution record, the interface execution record and the use case set execution record are stored in corresponding data tables.

2. The method according to claim 1, characterized in that On the interface editing page, parameter groups for different business scenarios are created for the interface, including: On the interface editing page, create parameter groups for different business scenarios for the interface; Testing the interface test case; If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface, and return to test the interface test case after the defect is fixed until the return value of the interface meets expectations and the assertion passes in the test results of the interface test case.

3. The method according to claim 1, characterized in that The method further comprises: In the event that the interface test case fails to execute, determining the assertion type corresponding to the interface test case; Asserting the interface test case according to the assertion configuration of the assertion type corresponding to the interface test case; Add the reason for the assertion failure to the failure reason list of the interface test case; Feedback the failure reason list of the interface test case to the front end for display.

4. An interface testing device, characterized in that: include: A use case set creation unit, used to create at least one use case set according to the test requirements; An interface creation unit, used to create an interface and bind the interface to at least one of the use case sets, each of which corresponds to at least one interface; wherein one interface corresponds to at least one use case set; after the interface is created, the use case set is subsequently bound in real time according to the test requirements; A parameter group creation unit, used to create parameter groups under different business scenarios for the interface on the interface editing page, each parameter group corresponding to an interface test case; A use case set execution unit, used to execute interface test cases of all the interfaces under the use case set; An interface execution unit, used to execute all interface test cases corresponding to the interface; The parameter group input types include static key-value pair input, interface response dynamic parsing input, extension function input, global variable input, and auxiliary calculation field input. The parameter group creation unit is specifically used to: On the interface editing page, set a parameter group name for the interface, where the parameter group name is used to identify the parameter group; Setting a test scenario description for the interface, wherein the test scenario description is used to describe a business scenario of the parameter group test; Setting a pre-processing operation for the interface, wherein the pre-processing operation is executed through an interface call before executing the interface test case; Setting a request header and request parameters for the interface, wherein the request parameters can be set to static key-value pairs, interface response dynamic parsed values, extended function calculated values, global variables or auxiliary calculated fields; Configure assertions for the interface. The assertion types include string assertion, json structure + field combination assertion, jsonp prefix + json structure + field combination assertion; Setting a post-processing operation for the interface, wherein the post-processing operation is executed through an interface call after executing the interface test case; The device also includes an execution record storage unit; The execution record storage unit is specifically used for: When executing the interface test cases of all the interfaces under the use case set, obtain the use case execution record, interface execution record and use case set execution record; wherein, the use case execution record refers to the request record generated by each parameter group requested by the interface; the interface execution record refers to the data record generated by the interface after executing all parameter groups managed under the interface; by viewing the interface execution record, the test case with execution problems can be located to debug the test case until all test cases of the interface pass the test; the use case set execution record refers to the data record generated by the use case set after executing all interfaces managed under the use case set; The use case execution record, the interface execution record and the use case set execution record are stored in corresponding data tables.

5. The device according to claim 4, characterized in that The parameter group creation unit is specifically used to: On the interface editing page, create parameter groups for different business scenarios for the interface; Testing the interface test case; If the return value of the interface does not meet expectations or the assertion fails, report the defect in the interface, and return to test the interface test case after the defect is fixed until the return value of the interface meets expectations and the assertion passes in the test results of the interface test case.

6. The device according to claim 4, characterized in that The device also includes a failure cause determination unit; The failure cause determination unit is specifically used to: In the event that the interface test case fails to execute, determining the assertion type corresponding to the interface test case; Asserting the interface test case according to the assertion configuration of the assertion type corresponding to the interface test case; Add the reason for the assertion failure to the failure reason list of the interface test case; Feedback the failure reason list of the interface test case to the front end for display.

Citation Information

Patent Citations

  • Interface testing method, system, device and storage medium based on database comparison

    CN109101415A

  • Interface test method and apparatus, electronic device and storage medium

    CN110569194A

  • Automatic test platform

    CN110928796A