Interface test method, device, equipment, storage medium and product

By obtaining the target reference field through the interface test request, the parameter value can be directly obtained from the stored target reference field. This solves the interface testing difficulties caused by the difficulty in referencing parameter values ​​between interfaces in the existing technology, simplifies the interface testing process, and reduces the error rate.

CN116257451BActive Publication Date: 2026-01-23INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310264994.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-17
Publication Date
2026-01-23
Estimated Expiration
2043-03-17

AI Technical Summary

Technical Problem

In existing technologies, the difficulty in referencing parameter values ​​between interfaces makes interface testing difficult, requiring the addition of a JSON extractor or the writing of complex scripts to extract JSON values ​​from the referenced interfaces.

Method used

By receiving interface test requests, obtaining target definition data, determining target reference fields, and directly retrieving parameter values ​​from the stored target reference fields, the need to write additional JSON extractors or scripts is avoided.

Benefits of technology

It enables the rapid and accurate acquisition of target parameter values, simplifies the interface testing process, reduces the probability of errors, and solves the problem of difficulty in referencing parameter values ​​between interfaces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257451B_ABST
    Figure CN116257451B_ABST
Patent Text Reader

Abstract

The application provides an interface test method, device, equipment, storage medium and product. The application belongs to the technical field of big data. The method comprises the following steps: receiving an interface test request for a target interface, obtaining corresponding target definition data based on the interface test request, the target definition data comprising a target parameter identifier of a target input parameter, in response to the target definition data not comprising a target parameter value corresponding to the target parameter identifier, determining a matching target reference field according to the target parameter identifier, the target reference field comprising the target parameter identifier and the corresponding target parameter value, the target reference field being a field determined and stored by a target reference interface in response to an interface test of the reference interface, obtaining the target parameter value according to the target reference field, and performing interface test on the target interface according to the target parameter value. The problem of interface test difficulty caused by difficulty in parameter value reference between interfaces in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of big data, and particularly relates to an interface testing method and device, equipment, a storage medium and a product. BACKGROUND

[0002] At present, with the development of the software testing industry, an interface is usually tested by an automatic method to improve the interface testing efficiency, and in the automatic interface testing, a parameter value usually needs to be referenced between multiple interfaces.

[0003] In the related art, the return data obtained in the interface testing is usually a JSON (JavaScript Object Notation) message in a JSON format, and in the case that the referenced interface needs to reference a JSON value in the JSON message returned by the referenced interface and take the JSON value as a parameter value of an input parameter of the referenced interface for interface testing, a JSON extractor needs to be added in the referenced interface and the referenced interface, the corresponding JSON value is extracted through the JSON extractor, or the data returned by the referenced interface is configured as a global variable, a script for obtaining the JSON value in the JSON message is written, the corresponding JSON value is extracted based on the written script, and after the JSON value as the parameter value is obtained, the interface testing is performed based on the value.

[0004] However, the method in the related art needs to add the JSON extractor in the referenced interface or write the script for extracting the JSON value, and the JSON extractor and the script for extracting the JSON value are usually complex, which causes the difficulty in referencing the parameter value and further causes the difficulty in the interface testing. That is, in the related art, there is a technical problem of the difficulty in the interface testing caused by the difficulty in referencing the parameter value between the interfaces. SUMMARY

[0005] The embodiments of the present application provide an interface testing method and device, equipment, a storage medium and a product, to solve the technical problem of the difficulty in the interface testing caused by the difficulty in referencing the parameter value between the interfaces in the prior art.

[0006] In a first aspect, the embodiments of the present application provide an interface testing method, comprising: receiving an interface testing request for a target interface; obtaining corresponding target definition data based on the interface testing request, the target definition data comprising: a target parameter identifier of a target input parameter; in response to the target definition data not comprising a target parameter value corresponding to the target parameter identifier, determining a target reference field matched with the target parameter identifier, the target reference field comprising the target parameter identifier and the corresponding target parameter value, the target reference field being a field determined and stored by a target reference interface in response to an interface test performed by the reference interface in response to the interface testing request; obtaining the target parameter value according to the target reference field; and performing an interface test on the target interface according to the target parameter value.

[0007] Optionally, before determining the target reference field matched with the target parameter identifier in response to the target definition data not comprising the target parameter value corresponding to the target parameter identifier, the method further comprises: determining whether the target definition data comprises the target parameter value corresponding to the target parameter identifier.

[0008] Optionally, the determining whether the target definition data comprises the target parameter value corresponding to the target parameter identifier comprises: determining whether a target parameter value corresponding to the target parameter identifier in the target definition data is empty; if it is determined that the target parameter value is not empty, determining that the target definition data comprises the target parameter value corresponding to the target parameter identifier; and if it is determined that the target parameter value is empty, determining that the target definition data does not comprise the target parameter value corresponding to the target parameter identifier.

[0009] Optionally, the determining whether the target definition data comprises the target parameter value corresponding to the target parameter identifier comprises: determining whether a target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty; if it is determined that the target reference interface identifier is empty, determining that the target definition data comprises the target parameter value corresponding to the target parameter identifier; and if it is determined that the target reference interface identifier is not empty, determining that the target definition data does not comprise the target parameter value corresponding to the target parameter identifier.

[0010] Optionally, the determining the target reference field matched with the target parameter identifier comprises: determining a target reference field identifier of the target reference field corresponding to the target parameter identifier from the target definition data; and determining the target reference field corresponding to the target reference field identifier from at least one pre-stored reference field.

[0011] Optionally, the target reference field identifier identifies a target reference interface identifier of the target reference interface; and determining the target reference field corresponding to the target reference field identifier from the pre-stored at least one reference field comprises: searching the reference field having a corresponding relationship with the target reference interface identifier from the preset database; and determining the reference field having the corresponding relationship with the target reference interface identifier as the target reference field.

[0012] Optionally, obtaining the target parameter value according to the target reference field comprises: determining target position information of the target parameter value in the target reference field from the target definition data; and determining the target parameter value from the target reference field according to the target position information.

[0013] Optionally, the target reference field comprises at least one parameter sequence, each parameter sequence comprises a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, the at least one parameter sequence comprises a target parameter sequence, the parameter identifier in the target parameter sequence is the same as the target parameter identifier; the target position information comprises the target parameter identifier and a target sequence number of the target parameter value in the at least one parameter value of the target parameter sequence; and determining the target parameter value from the target reference field according to the target position information comprises: determining the target parameter sequence from the at least one parameter sequence according to the target parameter identifier; and determining the target parameter value from the at least one parameter value of the target parameter sequence according to the target sequence number.

[0014] Optionally, before obtaining the corresponding target definition data based on the interface test request, the method further comprises: determining a target parameter identifier of the target input parameter and parameter value description information of the target input parameter, the parameter value description information of the target input parameter comprises the target parameter value of the target input parameter or a target reference field identifier used to determine the target reference field containing the target parameter value; and generating the target definition data of the target interface according to the target parameter identifier and the parameter value description information.

[0015] In a second aspect, an embodiment of the present application provides an interface test device, the device comprising: a receiving module configured to receive an interface test request for a target interface; a first obtaining module configured to obtain corresponding target definition data based on the interface test request, the target definition data comprising: a target parameter identifier of a target input parameter; a first determining module configured to, in response to the target definition data not comprising a target parameter value corresponding to the target parameter identifier, determine a matching target reference field according to the target parameter identifier, the target reference field comprising the target parameter identifier and the corresponding target parameter value, the target reference field being a field determined and stored by a target reference interface in response to an interface test request of a reference interface; a second obtaining module configured to obtain the target parameter value according to the target reference field; and a testing module configured to perform an interface test on the target interface according to the target parameter value.

[0016] In a third aspect, an embodiment of the present application provides an interface testing device, comprising: a processor, a memory connected with the processor in communication, and a transceiver; the memory stores computer execution instructions; the transceiver is configured to receive and transmit target data; and the processor executes the computer execution instructions stored in the memory to implement the method of any one of the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores computer execution instructions, and the computer execution instructions are configured to be executed by a processor to implement the interface testing method of any one of the first aspect.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, which comprises a computer program, and the computer program is configured to be executed by a processor to implement the method of any one of the first aspect.

[0019] The embodiments of the present application provide an interface testing method, device, equipment, storage medium and product, the method comprising: receiving an interface testing request for a target interface; obtaining corresponding target definition data based on the interface testing request, the target definition data comprising: a target parameter identifier of a target input parameter; in response to the target definition data not comprising a target parameter value corresponding to the target parameter identifier, determining a matching target reference field according to the target parameter identifier, the target reference field comprising the target parameter identifier and the corresponding target parameter value, the target reference field being a field determined and stored by a target reference interface in response to an interface test performed by the target reference interface on a reference interface; obtaining the target parameter value according to the target reference field; and performing interface testing on the target interface according to the target parameter value. Because the target reference field is obtained and stored when the target reference interface is tested, when the target definition data does not comprise the target parameter value corresponding to the target parameter identifier, the target parameter value can be quickly and accurately obtained from the stored target reference field, thereby realizing testing of the target interface. Compared with the related art, which requires adding a JSON extractor or writing a script for extracting a JSON value, the method of the present application can determine a matching target reference field according to the target parameter identifier, and then directly obtain the target parameter value from the stored target reference field, without the need for additionally writing a JSON extractor or a script for extracting a JSON value, so the method is simple and less prone to errors, and solves the technical problem of difficulty in interface testing caused by difficulty in parameter value reference between interfaces in the related art.

[0020] It should be understood that the content described in the foregoing summary section is not intended to define key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0022] Figure 1 A schematic diagram of an application scenario of the interface test method provided by an embodiment of the present application is shown in the following figure.

[0023] Figure 2 A flowchart of the interface test method provided by an embodiment of the present application is shown in the following figure.

[0024] Figure 3 A flowchart of the interface test method provided by another embodiment of the present application is shown in the following figure.

[0025] Figure 4 A flowchart of the method for determining the target parameter value from the target reference field in the interface test method provided by an embodiment of the present application is shown in the following figure.

[0026] Figure 5 A structural schematic diagram of the interface test device provided by an embodiment of the present application is shown in the following figure.

[0027] Figure 6 A structural schematic diagram of the interface test device provided by an embodiment of the present application is shown in the following figure.

[0028] The specific embodiments of the present application have been shown in the above drawings, and will be described in more detail hereinafter. These drawings and the written description are not intended to limit the scope of the present application in any way, but to illustrate the present application for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0029] The exemplary embodiments will be described in detail herein with reference to the attached drawings. Unless otherwise specified, the same numbers in different drawings indicate the same or similar elements. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0030] It should be noted that the interface test method, device, equipment, storage medium and product of the present application can be used in the field of big data, and can also be used in any field other than the field of big data. The application field of the interface test method, device, equipment, storage medium and product of the present application is not limited.

[0031] First, the terms involved in the present application are explained:

[0032] The JSON extractor refers to an extractor used to extract the corresponding parameter value from the response message of the referenced interface when the referenced interface needs to reference the parameter value from the referenced interface during interface testing.

[0033] The Postman tool is a tool for interface development and testing.

[0034] The JMeter tool is a tool developed based on Java and can be used for interface testing.

[0035] The Requests library is a third-party library in Python language that can send requests including request parameters to the server and get response data based on the sent request.

[0036] At present, with the development of the software testing industry, it is usually necessary to use an automated testing method to perform interface testing. In actual applications, during interface automated testing, parameter values usually need to be referenced between multiple interfaces. Specifically, the parameter value of the input parameter of a certain interface can be a certain JSON value in the return data of another interface, that is, a certain interface needs to reference the JSON value in the return data of the tested interface as the parameter value of the input parameter during interface testing, in which process, the tested interface is the referenced interface, and the interface of the referenced return data is the referenced interface. For example, in a user information management system, multiple interfaces can be included, specifically, the multiple interfaces can include a user ID modification interface for modifying a user identity document (English: Identity document, referred to as ID) and a user ID acquisition interface for acquiring a user ID. When the user ID modification interface is tested, the user ID modification interface needs to reference the user ID in the return data of the user ID acquisition interface and test the user ID modification interface with the user ID as the parameter value of the input parameter, in which process, the user ID modification interface is the referenced interface, and the user ID acquisition interface is the referenced interface.

[0037] In the related art, the Postman tool can be used to perform automatic testing of an interface. Specifically, data returned by a referenced interface is configured as a global variable, and a script for obtaining a JSON value in a JSON message returned by the referenced interface when the referenced interface is used to perform interface testing is written. The corresponding JSON value is extracted based on the written script, and the extracted JSON value is used as an input parameter of the referenced interface to perform interface testing. In the related art, the JMeter tool or a framework encapsulating the JMeter can also be used to perform automatic testing of an interface. Specifically, when a plurality of interfaces to be tested are defined, a JSON extractor is added to each interface. When a referenced interface is tested, the referenced interface extracts a JSON value from a JSON message returned by a referenced interface through the JSON extractor, where the extracted JSON value includes a parameter value of a reference interface input parameter. The referenced interface obtains a target parameter value from the JSON value through a reference symbol used to obtain the parameter value, and assembles the parameter value to obtain a request parameter. Then, a request including the request parameter is sent to a server to perform interface testing.

[0038] However, when the method in the related art is used to perform interface testing, a script for extracting a JSON value needs to be written, and the referenced interface also needs to define a rule for referencing the JSON value. In actual applications, the rule is usually difficult to understand and prone to errors, which can cause failure of parameter value extraction and thus failure of interface testing. When the JSON extractor is used to extract a parameter value, if the definition of the JSON extractor is incorrect or the returned data of the target referenced interface changes, the JSON extractor cannot extract the JSON value from the returned data, which can cause the referenced interface to fail to obtain the corresponding parameter value and thus fail to perform testing. Furthermore, the JSON extractor and the script for extracting the JSON value are usually difficult to debug and have low flexibility when applied, which can also make it difficult to reference parameter values between interfaces. That is, in the prior art, there is a technical problem of difficulty in interface testing caused by difficulty in referencing parameter values between interfaces.

[0039] To solve the technical problem of interface test difficulty caused by the difficulty of parameter value reference between interfaces in the related art, when the target definition data of the target interface does not include the target parameter value corresponding to the target parameter identifier, it is necessary to ensure that the target interface can obtain the target parameter value from the corresponding data of the target reference interface, specifically, it is necessary to ensure that the target interface can obtain the target parameter value from the target reference field obtained when the target reference interface is tested, and then test the target interface according to the target parameter value. Further, if the target definition data of the target interface does not include the target parameter value of the target input parameter, the matching target reference field is determined according to the target parameter identifier of the target input parameter included in the target definition data, the target parameter value is obtained according to the target reference field, and the target interface is tested according to the target parameter value, wherein the target reference field is a field determined and stored by the target reference interface after the reference interface test.

[0040] The application provides an application scenario of an interface test method, device, equipment, storage medium and product.

[0041] Figure 1 An application scenario of the interface test method, device, equipment, storage medium and product provided by the embodiment of the application is shown in FIG. Figure 1 As shown in the figure, the application scenario includes a client device 101, an interface test device 102, and a server 103. The interface test device 102 is communicatively connected to the client device 101 and the server 103.

[0042] The interface test device 102 can be located in an interface test device. Specifically, the interface test device 102 obtains an interface test request sent by the client device 101, and obtains corresponding target definition data according to the interface test request, wherein the target definition data includes a target parameter identifier of a target input parameter, determines whether the target definition data includes a target parameter value of a target input parameter of the target interface, extracts the target parameter value from the target definition data in response to the target definition data including the target parameter value corresponding to the target parameter identifier, and determines a matching target reference field according to the target parameter identifier in response to the target definition data not including the target parameter value corresponding to the target parameter identifier. The target parameter value is obtained according to the target reference field. After obtaining the target parameter value, the parameter values of all input parameters of the target interface are assembled to obtain a request parameter, and the request parameter is sent to the server 103 to test the target interface.

[0043] It should be noted that the application can implement a variety of interface test methods, for example, a user ID modification interface in a user information management system can be tested, and a target interface in other application scenarios can also be tested.

[0044] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0045] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes may not be described again in some examples. The embodiments of the present application will be described below with reference to the drawings.

[0046] Figure 2 The flowchart of the interface test method provided by an embodiment of the present application. The method execution body of the present application is an interface test device, which is located in an interface test equipment. Referring to Figure 2 The method of the present application includes the following solutions:

[0047] S201, receiving an interface test request for a target interface.

[0048] The target interface is the interface to be tested, and the interface test request includes the target interface identifier of the target interface and the instruction for indicating the interface test of the target interface.

[0049] It should be noted that there are many methods for receiving the interface test request for the target interface, which are not limited here.

[0050] S202, obtaining corresponding target definition data based on the interface test request, the target definition data including: target parameter identifier of target input parameter.

[0051] The target definition data is data for defining the target interface. The target input parameter is the input parameter of the target interface, and the target parameter identifier is the identifier of the target input parameter.

[0052] In one embodiment, the target definition data is data generated and stored according to data defining the target interface, in response to receiving the target interface test request, the target definition data is determined from the stored definition data of at least one interface according to the target interface identification in the target interface test request, and the target parameter identification of the target input parameter included in the target definition data is extracted. Wherein the definition data of at least one interface includes the interface identification of the corresponding interface, the target definition data can be determined by comparing the target interface identification with each interface identification, and the definition data with the same interface identification as the target interface identification is determined as the target definition data.

[0053] S203, in response to the target definition data not including the target parameter value corresponding to the target parameter identification, determining a matching target reference field according to the target parameter identification, the target reference field including the target parameter identification and the corresponding target parameter value, and the target reference field being a field determined and stored by the target reference interface in response to the interface test of the reference interface test request.

[0054] Wherein, the target parameter value is the value of the target input parameter corresponding to the target parameter identification. The target reference field is a field including at least the target parameter identification and the corresponding target parameter value.

[0055] For example, determining whether the target definition data includes the target parameter value corresponding to the target parameter identification can include the following scheme: by determining whether the target parameter value corresponding to the target parameter identification in the target definition data is empty, or by determining whether the target reference interface identification corresponding to the target parameter identification in the target definition data is empty, it is determined whether the target definition data includes the target parameter value corresponding to the target parameter identification.

[0056] In one embodiment, the target definition data includes the target parameter identification of the target input parameter, and the target reference field identification corresponding to the target parameter identification, wherein the target reference field identification can be the target reference interface identification. Correspondingly, in response to the target definition data not including the target parameter value corresponding to the target parameter identification, determining a matching target reference field according to the target parameter identification can include the following scheme: in response to the target definition data not including the target parameter value corresponding to the target parameter identification, determining the target reference field identification corresponding to the target parameter identification according to the target parameter identification, and then determining the field identification identical to the target reference field identification from the multiple field identifications included in the pre-stored multiple fields, and determining the field corresponding to the field identification as the target reference field. Wherein, the multiple fields are stored in a pre-set database, and the multiple fields and the multiple field identifications correspond one by one. For example, the field identification can be the interface identification of the corresponding interface.

[0057] Wherein, the target reference interface is an interface that has been tested.

[0058] In one embodiment, response data returned when the target reference interface is subjected to the interface test is acquired, and the response data and the target reference interface are stored in a preset database, wherein the response data includes the target reference field.

[0059] By way of example, the method of subjecting the target reference interface to the interface test can include the following scheme: acquiring all input parameter values of the target reference interface, assembling all input parameter values of the target reference interface into a request parameter, sending the request parameter to a server for the interface test, and acquiring response data returned by the server.

[0060] S204, obtaining a target parameter value according to the target reference field.

[0061] In one embodiment, the position of the target parameter value is determined according to the target parameter identifier in the target reference field, and the target parameter value is extracted from the position of the target reference field.

[0062] S205, subjecting the target interface to the interface test according to the target parameter value.

[0063] In one embodiment, a request parameter is acquired according to the target parameter value, and the request parameter is sent to a server for the interface test, so as to implement the interface test on the target interface.

[0064] In the optional embodiment, the interface test request for the target interface is received, corresponding target definition data is acquired based on the interface test request, the target definition data includes a target parameter identifier of a target input parameter, in response to the target definition data not including a target parameter value corresponding to the target parameter identifier, a target reference field matched with the target parameter identifier is determined, the target reference field includes the target parameter identifier and the corresponding target parameter value, the target reference field is a field determined and stored by the target reference interface in response to the reference interface test request for the interface test, the target parameter value is obtained according to the target reference field, and the target interface is subjected to the interface test according to the target parameter value. Because the target reference field is obtained and stored when the target reference interface is subjected to the interface test, when the target definition data does not include the target parameter value corresponding to the target parameter identifier, the target parameter value can be quickly and accurately acquired from the stored target reference field, and the test on the target interface is implemented. Compared with the related art in which a JSON extractor or a script for extracting a JSON value needs to be added, or a method for referencing the target parameter value based on the JSON extractor or the script for extracting the JSON value, in the method, the target reference field matched with the target parameter identifier is determined, and then the target parameter value is directly acquired from the stored target reference field, without the need of additionally adding the JSON extractor or the script for extracting the JSON value, so that the method is simple and less prone to errors, and the technical problem of the difficulty in the interface test caused by the difficulty in the parameter value reference between interfaces in the related art is solved.

[0065] In one embodiment, the interface test method further comprises: in response to the target definition data comprising the target parameter identification corresponding target parameter value, extracting the target parameter value from the target definition data; and performing interface test on the target interface according to the target parameter value.

[0066] In one embodiment, the target interface comprises a plurality of input parameters, each of the plurality of input parameters can be determined as a target input parameter in turn, and then the parameter value of each input parameter is obtained. The target input parameter can also be determined according to a random selection method, and each input parameter is traversed to obtain the parameter value of each input parameter. Each input parameter can also be determined as a target input parameter at the same time, and the corresponding target parameter value is obtained for each target input parameter, and then the parameter value of each input parameter in the target interface is obtained.

[0067] In one embodiment, there are a plurality of interfaces that need to be tested, and determining the target interface can include the following scheme: determining whether the parameter value of the input parameter of each interface needs to be referenced from the response data of other interfaces, determining the test order of the plurality of interfaces for interface test according to whether the parameter value of the input parameter of each interface needs to be referenced from the response data of other interfaces, and determining the corresponding interface as the target interface in turn according to the test order, wherein the interface that performs interface test before the target interface is the target reference interface, and the target interface needs to reference the target parameter value from the response data returned by the target reference interface. Correspondingly, after determining the test order of the plurality of interfaces for interface test, the interface identifiers of each interface can be sorted according to the test order for the plurality of interfaces, thereby obtaining an interface execution list, and the target interface is determined in turn according to the interface execution list.

[0068] The method of determining the test order of the plurality of interfaces for interface test according to whether the parameter value of the input parameter of each interface needs to be referenced from the response data of other interfaces is further described: the interface that needs to reference the parameter value from the response data of other interfaces is the reference interface, and the interface that is referenced is the referenced interface, wherein the test order of the referenced interface is earlier than that of the reference interface.

[0069] In some optional embodiments, in response to the target definition data not comprising the target parameter identification corresponding target parameter value, before determining the matching target reference field according to the target parameter identification, it further comprises: determining whether the target definition data comprises the target parameter identification corresponding target parameter value.

[0070] In one embodiment, whether the target definition data includes the target parameter value corresponding to the target parameter identification is determined by determining whether the target parameter value corresponding to the target parameter identification in the target definition data is empty, or by determining whether the target reference interface identification corresponding to the target parameter identification in the target definition data is empty.

[0071] In the optional embodiment, before determining the matching target reference field according to the target parameter identification in response to the target definition data not including the target parameter value corresponding to the target parameter identification, the method further includes: determining whether the target definition data includes the target parameter value corresponding to the target parameter identification. By determining whether the target definition data includes the target parameter value corresponding to the target parameter identification, it can be quickly determined whether the target reference field needs to be determined and the target parameter value needs to be obtained from the target reference field.

[0072] In some optional embodiments, determining whether the target definition data includes the target parameter value corresponding to the target parameter identification can include the following schemes:

[0073] S301, determining whether the target parameter value corresponding to the target parameter identification in the target definition data is empty.

[0074] In one embodiment, the target definition data includes an input parameter table in the form of a table. The input parameter table includes a cell for writing the target parameter identification, and a cell for writing the target parameter value corresponding to the target parameter identification, the cell for writing the target parameter identification and the cell for writing the target parameter value corresponding to the target parameter identification are located in the same row or the same column. According to the target parameter identification, the row or column where the target parameter value is located can be determined, and then the cell for writing the target parameter value corresponding to the target parameter identification is determined according to the determined row or column. According to whether there is a target parameter value in the cell for writing the target parameter value corresponding to the target parameter identification, or according to whether there is a keyword for identifying that the target parameter value is empty in the cell for writing the target parameter value corresponding to the target parameter identification, it is determined whether the target parameter value corresponding to the target parameter identification in the target definition data is empty.

[0075] In another embodiment, the target definition data includes a field for writing the target parameter identification, and a field for writing the target parameter value corresponding to the target parameter identification. According to whether there is a target parameter value in the field for writing the target parameter value corresponding to the target parameter identification, or according to whether there is a keyword for identifying that the target parameter value is empty in the field for writing the target parameter value corresponding to the target parameter identification, it is determined whether the target parameter value corresponding to the target parameter identification in the target definition data is empty.

[0076] S302, if it is determined that the target parameter value corresponding to the target parameter identifier is not empty, it is determined that the target parameter value corresponding to the target parameter identifier is included in the target definition data.

[0077] For example, if it is determined that there is a target parameter value in the cell or field for writing the target parameter value corresponding to the target parameter identifier, or that a keyword for identifying that the target parameter value is empty is not written in the cell or field for writing the target parameter value corresponding to the target parameter identifier, it is determined that the target parameter value corresponding to the target parameter identifier in the target definition data has a corresponding relationship, and it is determined that the target parameter value corresponding to the target parameter identifier is included in the target definition data.

[0078] S303, if it is determined that the target parameter value corresponding to the target parameter identifier is empty, it is determined that the target parameter value corresponding to the target parameter identifier is not included in the target definition data.

[0079] For example, if it is determined that there is no target parameter value in the cell or field for writing the target parameter value corresponding to the target parameter identifier, or that a keyword for identifying that the target parameter value is empty is written in the cell or field for writing the target parameter value corresponding to the target parameter identifier, it is determined that the target parameter value corresponding to the target parameter identifier in the target definition data is empty, and it is determined that the target parameter value corresponding to the target parameter identifier is not included in the target definition data.

[0080] In the optional embodiment, it is determined whether the target parameter value corresponding to the target parameter identifier in the target definition data is empty; if it is determined that the target parameter value corresponding to the target parameter identifier is not empty, it is determined that the target parameter value corresponding to the target parameter identifier is included in the target definition data; if it is determined that the target parameter value corresponding to the target parameter identifier is empty, it is determined that the target parameter value corresponding to the target parameter identifier is not included in the target definition data. By determining whether the target parameter value corresponding to the target parameter identifier in the target definition data is empty, it can be quickly determined whether the target parameter value corresponding to the target parameter identifier is included in the target definition data.

[0081] In some optional embodiments, it is determined whether the target parameter value corresponding to the target parameter identifier is included in the target definition data, comprising:

[0082] S401, it is determined whether the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty.

[0083] The target reference interface identifier is an identifier of the target reference interface. The target reference interface identifier is used to determine the target reference field from at least one reference field in the preset database, wherein the at least one reference field respectively has a corresponding field identifier, and the field identifier can be an interface identifier of a corresponding interface. The target reference field is one of the at least one reference field. It should be noted that the target reference interface identifier can be used as the target reference field identifier of the target reference field.

[0084] In one embodiment, the target definition data includes an input parameter table in a form of a table. The input parameter table includes a cell for writing a target parameter identifier, and a cell for writing a target reference interface identifier of a target reference field, the cell for writing the target parameter identifier and a cell for writing a target parameter value corresponding to the target parameter identifier are in a same row or a same column. The row or the column where the target parameter value is located can be determined according to the target parameter identifier, and then the cell for writing the target parameter value corresponding to the target parameter identifier is determined. For example, whether the target reference interface identifier is empty in the cell for writing the target reference interface identifier of the target reference field, or whether a keyword for identifying that the target reference interface identifier is empty is in the cell for writing the target reference interface identifier of the target reference field, determines whether the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty.

[0085] In another embodiment, the target definition data includes a field for writing a target parameter identifier, and a field for writing a target reference interface identifier of a target reference field, whether the target reference interface identifier is empty in the field for writing the target reference interface identifier of the target reference field, or whether a keyword for identifying that the target reference interface identifier is empty is in the field for writing the target reference interface identifier of the target reference field, determines whether the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty.

[0086] S402, if it is determined that the target reference interface identifier is empty, it is determined that the target definition data includes a target parameter value corresponding to the target parameter identifier.

[0087] For example, if it is determined that the target reference interface identifier is not in the cell or the field for writing the target reference interface identifier of the target reference field, or the keyword for identifying that the target reference interface identifier is empty is in the cell or the field for writing the target reference interface identifier of the target reference field, it is determined that the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty, and it is determined that the target definition data includes a target parameter value corresponding to the target parameter identifier.

[0088] S403, if it is determined that the target reference interface identifier is not empty, it is determined that the target definition data does not include a target parameter value corresponding to the target parameter identifier.

[0089] For example, if it is determined that there is no target reference interface identifier in the cell or field for writing the target reference interface identifier of the target reference field, or there is no keyword for identifying that the target reference interface identifier is empty in the cell or field for writing the target reference interface identifier of the target reference field, it is determined that the target reference interface identifier corresponding to the target parameter identifier in the target definition data is not empty, and it is determined that the target definition data does not contain the target parameter value corresponding to the target parameter identifier.

[0090] In the optional embodiment, it is determined whether the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty. If it is determined to be empty, it is determined that the target definition data contains the target parameter value corresponding to the target parameter identifier. If it is determined to be not empty, it is determined that the target definition data does not contain the target parameter value corresponding to the target parameter identifier. By determining whether the target reference interface identifier corresponding to the target parameter identifier in the target definition data is empty, it can be quickly determined whether the target definition data contains the target parameter value corresponding to the target parameter.

[0091] In some optional embodiments, determining the target reference field corresponding to the target parameter identifier can include the following scheme:

[0092] S501, determining the target reference field identifier of the target reference field corresponding to the target parameter identifier from the target definition data.

[0093] The target reference field identifier is an identifier for determining the target reference field.

[0094] In one embodiment, the target definition data includes an input parameter table in the form of a table. The input parameter table includes a cell for writing the target reference field identifier of the target reference field. The target reference field identifier corresponding to the target parameter identifier is extracted from the cell for writing the target reference field identifier of the target reference field.

[0095] In another embodiment, the target definition data includes a field for writing the target reference field identifier of the target reference field. The target reference field identifier corresponding to the target parameter identifier is extracted from the field for writing the target reference field identifier of the target reference field.

[0096] S502, determining the target reference field corresponding to the target reference field identifier from the pre-stored at least one reference field. The pre-stored at least one reference field is determined from the response data obtained from the server after the at least one test interface is tested and stored in a preset database.

[0097] The service end can be a server, a mobile computer, or another device with an interface test function. The response data is test result data returned when the interface is tested.

[0098] In one embodiment, determining the at least one reference field pre-stored in the preset database can include the following scheme: for each of the at least one test interface, all input parameters thereof are assembled into request parameters respectively, and the request parameters are sent to the service end, and then the corresponding response data is obtained, and the response data is stored in the preset database, thereby obtaining the at least one reference field pre-stored in the preset database. The response data can be JSON format data.

[0099] In one embodiment, the data in the preset database includes at least one field identifier and a reference field corresponding to each field identifier respectively. A field identifier matching the target reference field identifier is determined from the at least one field identifier, and the reference field corresponding to the field identifier is determined as the target reference field corresponding to the target reference field identifier.

[0100] In this optional embodiment, the target reference field identifier corresponding to the target reference field is determined from the target definition data; the target reference field corresponding to the target reference field identifier is determined from the at least one pre-stored reference field; and the at least one pre-stored reference field is determined from the response data obtained from the service end after the at least one test interface is tested and stored in the preset database. According to the target reference field identifier, the target reference field can be quickly and accurately determined from the at least one pre-stored reference field.

[0101] In some optional embodiments, the target reference field identifier includes a target reference interface identifier of a target reference interface.

[0102] The target reference interface identifier is an identifier of the target interface.

[0103] Accordingly, determining the target reference field corresponding to the target reference field identifier from the at least one pre-stored reference field can include the following steps:

[0104] S601, finding a reference field having a corresponding relationship with the target reference interface identifier from the preset database.

[0105] In one embodiment, the preset database includes at least one reference interface identifier and a reference field corresponding to each reference interface identifier respectively. A reference interface identifier identical to the target reference interface identifier is found from the at least one reference interface identifier, and the reference field corresponding to the reference interface identifier is determined as the reference field having the corresponding relationship with the target reference interface identifier.

[0106] S602, determine the reference field corresponding to the target reference interface identifier as the target reference field.

[0107] It should be noted that there are many methods to determine the reference field corresponding to the target reference interface identifier as the target reference field, which are not limited here.

[0108] In the optional embodiment, the target reference field identifier includes the target reference interface identifier of the target reference interface; accordingly, the reference field corresponding to the target reference interface identifier is found from the preset database; and the reference field corresponding to the target reference interface identifier is determined as the target reference field. According to the target reference interface identifier of the target reference interface, the target reference field corresponding to the target reference field identifier can be quickly determined from the preset database.

[0109] In some optional embodiments, obtaining the target parameter value according to the target reference field can include the following scheme:

[0110] S701, determine the target position information of the target parameter value in the target reference field from the target definition data.

[0111] The target position information is used to describe the position of the target parameter value in the target reference field.

[0112] In one embodiment, the target definition data includes an input parameter table in the form of a table. The input parameter table includes a cell for writing the target position information of the target parameter value. The target position information of the target parameter value in the target reference field is obtained by extracting data from the cell.

[0113] In another embodiment, the target definition data includes a field for writing the target position information of the target parameter value. The target position information of the target parameter value in the target reference field is obtained by extracting data from the field.

[0114] S702, determine the target parameter value from the target reference field according to the target position information.

[0115] In one embodiment, the position of the target parameter value in the target reference field is determined according to the target position information, and then the target parameter value is extracted from the position.

[0116] In the optional embodiment, the target position information of the target parameter value in the target reference field is determined from the target definition data, and the target parameter value is determined from the target reference field according to the target position information. According to the target position information, the position of the target parameter value in the target reference field can be determined, and then the target parameter value can be accurately and quickly extracted from the position.

[0117] In some optional embodiments, the target reference field includes at least one parameter sequence, each parameter sequence includes a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, and the at least one parameter sequence includes a target parameter sequence, the parameter identifier in the target parameter sequence is the same as the target parameter identifier.

[0118] Correspondingly, the target position information includes the target parameter identifier and a target sequence number of the target parameter value in the at least one parameter value in the target parameter sequence.

[0119] Correspondingly, the target position information includes the target parameter identifier and a target sequence number of the target parameter value in the at least one parameter value in the target parameter sequence.

[0120] Correspondingly, according to the target position information, the target parameter value is determined from the target reference field, including:

[0121] S801, according to the target parameter identifier, the target parameter sequence is determined from the at least one parameter sequence.

[0122] In one embodiment, by respectively comparing the parameter identifier of the at least one parameter sequence in the target reference field and the target parameter identifier, the parameter sequence corresponding to the parameter identifier same as the target parameter identifier is determined as the target parameter sequence.

[0123] S802, according to the target sequence number, the target parameter value is determined from the at least one parameter value in the target parameter sequence.

[0124] In one embodiment, the parameter value with the same sequence number as the target sequence number in the at least one parameter value in the target parameter sequence is determined as the target parameter value.

[0125] In the optional embodiment, the target reference field includes at least one parameter sequence, each parameter sequence includes a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, the at least one parameter sequence includes a target parameter sequence, the parameter identifier in the target parameter sequence is the same as the target parameter identifier; the target position information includes the target parameter identifier and a target sequence number of the target parameter value in the at least one parameter value of the target parameter sequence. Correspondingly, determining the target parameter value from the target reference field according to the target position information includes: determining the target parameter sequence from the at least one parameter sequence according to the target parameter identifier; and determining the target parameter value from the at least one parameter value of the target parameter sequence according to the target sequence number. According to the target parameter identifier, the target parameter sequence can be quickly determined from the at least one parameter sequence, and according to the target sequence number included in the target position information, the target parameter value can be quickly and accurately determined from the at least one parameter value of the target parameter sequence.

[0126] In some optional embodiments, before obtaining the corresponding target definition data based on the interface test request, the following scheme is further included:

[0127] S901, determining a target parameter identifier of a target input parameter and parameter value description information of the target input parameter, the parameter value description information of the target input parameter including a target parameter value of the target input parameter or including a target reference field identifier of a target reference field used for determining the target reference field containing the target parameter value.

[0128] The parameter value description information is used for determining the parameter value of the target input parameter.

[0129] In one embodiment, determining the target parameter identifier of the target input parameter can include the following scheme: determining the target parameter identifier of the target input parameter according to user demand. For example, if the target input parameter is a user ID, the character "instrumentId" can be used as the identifier of the user ID.

[0130] In one embodiment, the parameter value description information of the target input parameter is determined according to whether the target parameter value needs to be obtained from the target reference field. Specifically, if the target parameter value needs to be obtained from the target reference field, the target reference field identifier of the target reference field is determined, and the target reference field identifier is used as the parameter value description information. If the target parameter value can be directly determined and does not need to be obtained from the target reference field, the target parameter value is used as the parameter value description information.

[0131] S902, generating target definition data of the target interface according to the target parameter identifier and the parameter value description information.

[0132] In one embodiment, the template is used to generate the target definition data of the target interface according to the target definition data, the target parameter identifier and the parameter value description information.

[0133] In one embodiment, the template includes an input parameter table for writing the target parameter identifier and the parameter value description information, and the target definition data is obtained by writing the target parameter identifier and the parameter value description information into corresponding cells of the input parameter table.

[0134] In another embodiment, the target definition data of the target interface is obtained by writing the target parameter identifier and the parameter value description information into corresponding fields.

[0135] In the optional embodiment, the target parameter identifier of the target input parameter and the parameter value description information of the target input parameter are determined, the parameter value description information of the target input parameter includes the target parameter value of the target input parameter or includes a target reference field identifier for determining a target reference field containing the target parameter value; and the target definition data of the target interface is generated according to the target parameter identifier and the parameter value description information. The target definition data thus obtained includes the target parameter identifier of the target input parameter and the parameter value description information of the target input parameter, which is equivalent to determining the target input parameter and the rule for obtaining the target parameter value when the target interface is defined, so that the rule for obtaining the target parameter value does not need to be defined additionally when the target parameter value is obtained, thereby improving the efficiency of obtaining the target parameter value.

[0136] In one embodiment, the parameter value description information of the target input parameter further includes a target reference field identifier for determining a target reference field containing the target parameter value, and the target reference field identifier is used to determine the target reference field, wherein the target reference field identifier can be a target reference interface identifier of a target reference interface. Further, the target reference field includes at least one parameter sequence, each parameter sequence includes a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, the at least one parameter sequence includes a target parameter sequence, and the parameter identifier in the target parameter sequence is the same as the target parameter identifier. The parameter value description information of the target input parameter further includes target position information, the target position information includes the target parameter identifier and a target sequence number of the target parameter value in the at least one parameter value of the target parameter sequence, and the target position information is used to determine the target parameter value from the target reference field.

[0137] The method for testing the interface is further described below. Figure 3 The flowchart of the method for testing the interface according to another embodiment of the present application is shown in FIG. 2. Figure 3 As shown in FIG. 2, the method for testing the interface includes the following schemes:

[0138] S10, define the interface.

[0139] The defined interface includes a plurality of interfaces, and the plurality of interfaces at least includes a target interface and a target reference interface.

[0140] Specifically, each interface is defined by determining definition data for defining each interface. The definition data for defining the interface can include the following schemes:

[0141] S1001, determine the basic information of the interface and the parameter value description information of the input parameter.

[0142] The basic information of the interface can include the following information:

[0143] The interface identifier (ID) is used as the identifier of the interface. For example, the interface identifier can be set according to user demand, or can be randomly generated according to a module for generating the interface identifier.

[0144] The interface name is used to intuitively describe the function of the interface. In the case where the functions of a plurality of interfaces to be tested are different, the interface name can also be used as the identifier of the interface. For example, the interface for user login can use the character "login" as the interface name of the interface, the interface for data query can use the character "Query" as the interface name of the interface, and the interface for data modification can use the character "Edit" as the interface name of the interface.

[0145] The interface address is used to represent the address of the interface. During interface testing, the server can determine the interface to be returned in response to the data according to the interface address. For example, the interface address can be a uniform resource locator (URL).

[0146] The data transmission method of the interface is used to represent the method of transmitting data of the interface. For example, the data transmission method can be sending (Post) or getting (get).

[0147] After determining the above basic information, the basic information can be written into a basic information table. In one embodiment, the basic information table is shown in Table 1:

[0148] Table 1

[0149]

[0150]

[0151] In Table 1, characters "1" and "2" are serial numbers of two interfaces, and the serial numbers of the interfaces can be used as interface identifiers of the interfaces. Characters "Query" and "Edit" represent interface names of a query interface for data query and an edit interface for data modification, respectively. Because the interface names of the respective interfaces are different, the interface names can also be used as the interface identifiers. The string " / api / vl / service / fidb / instrumentSpecific / RiskBondInst / queryInstSpecificList" and the string " / api / vl / service / fidb / instrumentSpecific / RiskBondInst / doEdit" represent interface URLs of the query interface "Query" and the edit interface "Edit", respectively.

[0152] For example, the parameter value description information of the input parameter can include an interface identifier of the interface, a parameter identifier of the input parameter, and parameter value description information of the input parameter. Specifically, the parameter value description information includes a parameter value, a reference interface identifier, and position information.

[0153] After the parameter value description information is determined, the parameter value description information can be written into the input parameter table. In an embodiment, the input parameter table is shown in Table 2.

[0154] Table 2

[0155]

[0156] In Table 2, characters "instrumentName" and "instrumentId" represent parameter identifiers of input parameters of two interfaces, respectively. For example, the parameter names of the input parameters can be used as the parameter identifiers of the input parameters.

[0157] Referring to Table 2, the definition data of the interface 1 includes a parameter value corresponding to the parameter identifier "instrumentName", and the parameter value is "IFT7YY=CDC".

[0158] Continuing to refer to Table 2, the definition data of the interface 2 does not include a parameter value corresponding to the parameter identifier "instrumentId". The character "Query" is a reference interface identifier, and the string "value.list[0].instrumentId" is position information corresponding to the parameter identifier "instrumentId".

[0159] S11, configuring an interface execution list.

[0160] Specifically, the interface execution list is generated according to the plurality of interfaces defined by the step S10, and the order of the interface test is configured, wherein the interface execution list comprises interface identifiers of the plurality of test interfaces arranged according to the order of the interface test. Further, the order of the interface test is determined according to the following scheme: the interface referenced is tested first, and the test interface requiring the parameter value obtained from the reference field corresponding to the referenced interface is tested later. For example, the user ID modification interface needs to reference the user ID obtained by the user ID obtaining interface tested later, and the user ID is used as the input parameter to test the user ID modification interface. In this application scenario, the user ID obtaining interface is tested first, and then the user ID modification interface is tested.

[0161] S12, determining the target interface to be tested from the interface execution list.

[0162] It should be noted that the method of determining the target interface has been described in the foregoing embodiments, and will not be repeated here.

[0163] S13, determining whether the target interface is obtained successfully. If yes, the step S14 is entered, otherwise the operation is ended.

[0164] For example, the interface test request for the target interface is received, wherein the target interface identifier of the target interface is included in the interface test request. By comparing the target interface identifier with the interface identifiers of the plurality of interfaces in the interface execution list, it is determined whether the target interface identifier in the interface test request is one of the plurality of interface identifiers in the execution list.

[0165] If the target interface identifier in the interface test request is one of the plurality of interface identifiers in the execution list, it means that the target interface is obtained successfully.

[0166] If the target interface identifier in the interface test request is not one of the plurality of interface identifiers in the execution list, it means that the target interface is not obtained successfully. It should be noted that the target interface is not obtained successfully, which may be caused by the error of the target interface identifier in the interface test request, or the error of the target interface in the target definition data of the target interface, or other reasons. In this case, an error is reported, and the next interface is continued to be obtained, which is equivalent to the end of the interface test of the target interface corresponding to the target interface identifier in the interface test request.

[0167] S14, determining whether the target parameter value needs to be obtained from the target reference field. If yes, the step

[0168] S15, otherwise, the target parameter value is directly extracted from the target definition data, and then the step S18 is entered.

[0169] Specifically, whether the target parameter value needs to be acquired from the target reference field is determined according to whether the target definition data of the target interface contains the target parameter value corresponding to the target parameter identifier.

[0170] Taking the target interface as interface 1 in Table 2 and the target parameter identifier as "instrumentName" as an example, it is shown in Table 2 that the target definition data corresponding to the target interface 1 contains the target parameter value corresponding to the target parameter identifier "instrumentName", and the target parameter value is "IFT7YY=CDC". In this case, the target parameter value does not need to be acquired from the target reference field, and the target parameter value can be directly extracted from the target definition data.

[0171] Taking the target interface as interface 2 in Table 2 and the target parameter identifier as "instrumentId" as an example, it is shown in Table 2 that the target definition data corresponding to the target interface 2 does not contain the target parameter value corresponding to the target parameter identifier "instrumentId", and the target parameter value is empty. In this case, the target parameter value needs to be acquired from the target reference field.

[0172] S15, acquiring the target parameter value that needs to be referenced from a preset database.

[0173] The preset database is described with reference to the definition data shown in Table 1 and Table 2. According to the definition data shown in Table 1 and Table 2, if the target interface is interface 2, the target parameter value corresponding to the target parameter identifier "instrumentId" needs to be acquired from the target reference field corresponding to the reference interface identifier "Query", or needs to be acquired from the target reference field corresponding to interface 1 when the target interface is tested. In this case, interface 1 is the target reference interface.

[0174] The target reference field corresponding to interface 1 is stored in the preset database. For example, the preset database containing the target reference field is shown in Table 3.

[0175] Table 3

[0176]

[0177] It should be noted that the preset database includes at least one reference interface identifier and at least one reference field corresponding to the at least one reference interface identifier. Table 3 only provides the interface identifier of interface 1 and the reference field corresponding thereto as an example, but does not mean that the preset database can only contain this set of data.

[0178] The interface 2 is a target interface, and the interface 1 is a target reference interface, so the reference field corresponding to the interface 1 in Table 3 is a target reference field. Correspondingly, referring to Table 3, the string "{"retCode":0,"retMsg":"success","value":{"total":"2","list":[{"instrumentId":"1000000094586","instrumentName":"zxy0988","}]}}” is the target reference field.

[0179] Figure 4 A flow chart of a method for determining a target parameter value from a target reference field in an interface test method provided by an embodiment of the present application is shown in Figure 1. The method for determining a target parameter value from a target reference field is further described below with reference to Figure 4 , the method includes the following steps: Figure 4

[0180] S1501, obtaining a target reference field that needs to be referenced from a preset database.

[0181] In the case that the preset data includes a plurality of reference interface identifiers and a plurality of reference fields corresponding to the plurality of reference interface identifiers respectively, the target reference field can be determined from the plurality of reference fields corresponding to the plurality of reference interface identifiers according to the target reference interface identifier.

[0182] S1502, determining target position information from target definition data.

[0183] ​For example, according to the target parameter identifier, the target position information is determined from the target definition data. Referring to Table 2, the target interface is interface 2, and the target position description information of the target parameter value corresponding to the target parameter identifier "instrumentId" is "value.list[0].instrumentId". The target position information "value.list[0].instrumentId" is further described in combination with the target reference field shown in Table 3: the target position description information "value.list[0].instrumentId" is a description conforming to the requirements of a regular expression, and according to the target position description information, the target parameter value is in at least one parameter sequence corresponding to the character "valve". Specifically, the target parameter value is in a target sequence number [0] of a target parameter sequence "list" having the same parameter identifier as the target parameter identifier "instrumentId". It should be noted that in the regular expression, the target sequence number [0] indicates that the target parameter value is the first value in at least one parameter value of the target parameter sequence. That is, the target parameter value is the first value in the target parameter sequence "list" having the same parameter identifier as the target parameter identifier "instrumentId".

[0184] In S1503, the target parameter value is determined from the target reference field according to the target position information.

[0185] According to the foregoing analysis, the target parameter value is the first value in the target parameter sequence "list" having the same parameter identifier as the target parameter identifier "instrumentId", and it can be further known from Table 3 that the target parameter value corresponding to the target parameter identifier "instrumentId" is "1000000094586".

[0186] In S1504, the determined target parameter value is saved in the target definition data.

[0187] Specifically, the determined target parameter value is saved in a cell or a field in which the target parameter value is filled in the target definition data. As shown in Table 2, the determined target parameter value "1000000094586" is saved in the cell of the parameter value corresponding to interface 2.

[0188] In S16, it is determined whether the target parameter value is acquired successfully; if yes, S18 is performed, and if not, S17 is performed.

[0189] For example, if the target reference field can be determined from the preset database according to the target reference interface identifier, and the target parameter value is determined from the target reference field according to the target position information, it is determined that the target parameter value is acquired successfully, and otherwise, it is determined that the target parameter value is not acquired successfully.

[0190] S17, skip testing the target interface and return to step S12.

[0191] It should be noted that the failure to obtain the target parameter value can be due to the fact that the target reference interface that needs to be referenced has not been tested, resulting in the absence of the target reference field in the preset database. In this case, the target interface can be skipped first, and the target reference interface can be tested to ensure that the target reference field is stored in the preset database, thereby ensuring that the target parameter value can be successfully obtained when the target interface is tested.

[0192] S18, assemble the request.

[0193] Specifically, all input parameter values of the target interface are assembled into request parameters. It should be noted that all input parameter values of the target interface include the target parameter value.

[0194] S19, send the request.

[0195] For example, the request including the request parameters is sent to the server using the requests library based on the Python language, and the response data returned by the server is obtained through the requests library.

[0196] S20, obtain the response data.

[0197] For example, the obtained response data is a JSON message in JSON format.

[0198] S21, store the response data in the preset database, and then return to step S12.

[0199] For example, the JSON message is stored in the preset database as shown in Table 3. Specifically, the JSON value in the response data is obtained through the requests library, and the obtained JSON value is stored in the preset data through the encapsulated public method for use by other interfaces that need to reference parameter values.

[0200] It should be noted that after all the test interfaces in the interface execution list are tested according to steps S12 to S21, the data in the preset database can be cleaned up to save storage resources.

[0201] For example, the method of the present optional embodiment can be implemented based on the Python language.

[0202] In the optional embodiment, the target input parameter for obtaining the target parameter value is determined when the target interface is defined, and the target reference interface identifier and the target position information for extracting the target parameter value are determined. The target reference field can be determined from the preset database through the target reference interface identifier, and the target parameter value can be obtained from the target reference field according to the target position information. The target database includes at least one interface identifier and reference fields corresponding to the at least one interface identifier, respectively. The reference fields are obtained by the requests library when the corresponding interface is tested.

[0203] Therefore, when the target interface is tested, the rule for obtaining the target parameter value does not need to be defined additionally, the efficiency of obtaining the target parameter value is improved, and the test efficiency of the target interface is improved. In addition, after the reference interface is tested, the obtained response data is stored in the preset database, and when the target interface is tested, the target parameter value can be directly determined from the preset database, the flexibility of the target parameter value reference is improved, and the test efficiency of the target interface is improved.

[0204] Figure 5 The structure diagram of the interface test device provided by an embodiment of the application is shown in FIG. 1. Figure 5 As shown in FIG. 1, the interface test device provided by the embodiment is located in the interface test equipment. The interface test device 110 provided by the embodiment includes a receiving module 1101, a first obtaining module 1102, a first determining module 1103, a second obtaining module 1104, and a test module 1105.

[0205] The receiving module 1101 is configured to receive an interface test request for a target interface. The first obtaining module 1102 is configured to obtain corresponding target definition data based on the interface test request. The target definition data includes a target parameter identifier of a target input parameter. The first determining module 1103 is configured to determine a matching target reference field according to the target parameter identifier in response to the target definition data not including a target parameter value corresponding to the target parameter identifier. The target reference field includes the target parameter identifier and the corresponding target parameter value. The target reference field is a field determined and stored by a target reference interface after an interface test is performed in response to a reference interface test request. The second obtaining module 1104 is configured to obtain the target parameter value according to the target reference field. The test module 1105 is configured to perform an interface test on the target interface according to the target parameter value.

[0206] The interface test device provided by the embodiment can perform the method embodiment shown in FIG. 2. Figure 2 The implementation principle and technical effects of the technical solutions of the method embodiment shown in FIG. 2 are similar to those of the interface test device, and will not be described here.

[0207] Optionally, the interface device further comprises a second determining module, which is specifically configured to determine whether the target parameter value corresponding to the target parameter identifier is included in the target definition data.

[0208] Optionally, the second determining module is further configured to determine whether the target parameter value corresponding to the target parameter identifier is empty in the target definition data; if it is determined that the target parameter value is not empty, it is determined that the target parameter value corresponding to the target parameter identifier is included in the target definition data; if it is determined that the target parameter value is empty, it is determined that the target parameter value corresponding to the target parameter identifier is not included in the target definition data.

[0209] Optionally, the second determining module is further configured to determine whether the target reference interface identifier corresponding to the target parameter identifier is empty in the target definition data; if it is determined that the target reference interface identifier is not empty, it is determined that the target parameter value corresponding to the target parameter identifier is included in the target definition data; if it is determined that the target reference interface identifier is empty, it is determined that the target parameter value corresponding to the target parameter identifier is not included in the target definition data.

[0210] Optionally, the first determining module 1103 is further configured to determine the target reference field identifier of the target reference field corresponding to the target parameter identifier from the target definition data, and determine the target reference field corresponding to the target reference field identifier from the pre-stored at least one reference field.

[0211] Optionally, the target reference field identifier comprises a target reference interface identifier of the target reference interface; correspondingly, the first determining module 1103 is further configured to search for a reference field corresponding to the target reference interface identifier from the preset database, and determine the reference field corresponding to the target reference interface identifier as the target reference field.

[0212] Optionally, the second obtaining module 1104 is further configured to determine the target position information of the target parameter value in the target reference field from the target definition data, and determine the target parameter value in the target reference field according to the target position information.

[0213] Optionally, the target reference field comprises at least one parameter sequence, each parameter sequence comprises a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, the at least one parameter sequence comprises a target parameter sequence, the parameter identifier in the target parameter sequence is the same as the target parameter identifier; the target position information comprises the target parameter identifier and a target serial number of the target parameter value in the at least one parameter value in the target parameter sequence.

[0214] The second obtaining module 1104 is also specifically configured to: determine a target parameter sequence from the at least one parameter sequence according to the target parameter identifier; and determine a target parameter value from the at least one parameter value of the target parameter sequence according to the target sequence number.

[0215] Optionally, the interface test module further comprises a third determining module and a generating module, wherein the third determining module is configured to determine a target parameter identifier of the target input parameter and parameter value description information of the target input parameter, the parameter value description information of the target input parameter comprising the target parameter value of the target input parameter or comprising a target reference field identifier of a target reference field containing the target parameter value; and the generating module is configured to generate target definition data of the target interface according to the target parameter identifier and the parameter value description information.

[0216] Figure 6 is a structural schematic diagram of an interface test device provided by an embodiment of the present application. As shown in Figure 6 the interface test device 120 provided by the embodiment comprises a processor 1201, a memory 1202 in communication connection with the processor, and a transceiver 1203.

[0217] The memory stores computer execution instructions; the transceiver is configured to receive and transmit target data; and the processor executes the computer execution instructions stored in the memory to implement the interface test method provided by the corresponding embodiment.

[0218] The relevant description can be understood in correspondence with the relevant description and effects of the steps in the drawings, and thus will not be described in detail here.

[0219] In Figure 6 In the corresponding embodiment, the program can comprise program code, and the program code comprises computer execution instructions. The memory can comprise a high-speed RAM memory and can also comprise a non-volatile memory such as at least one disk memory.

[0220] The memory, the transceiver and the processor are connected through a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a target data bus and a control bus, etc. For the convenience of representation, Figure 6 only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0221] The embodiment of the present application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the interface test method provided by any one of the embodiments of the present application.

[0222] The embodiment of the present application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the interface test method provided by any one of the embodiments.

[0223] In several embodiments of the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and the division of modules can be different, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the modules shown or discussed can be indirect coupling or communication connection through some interface, device or module, and can be electrical, mechanical or other forms.

[0224] The modules illustrated as separate components can or can not be physically separate, and the components illustrated as modules can or can not be physical modules, i.e., can be located in one place or distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0225] In addition, the functional modules in each embodiment of the present application can be integrated into a processing module, or each module can exist physically, or two or more modules can be integrated into one module. The above integrated module can be realized in the form of hardware or in the form of hardware plus software function module.

[0226] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, a special purpose computer, or other programmable data processing apparatus, so that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a separate software package, and partially on a remote machine or server.

[0227] In the context of the present application, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.

[0228] Moreover, while operations have been depicted in a particular order, this should not be understood as requiring such order nor that all illustrated operations be performed, to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while several specific implementation details have been discussed, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination.

[0229] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

1. An interface testing method, characterized in that, include: Receive interface test requests for the target interface; The target parameter identifier of the target input parameter and the parameter value description information of the target input parameter are determined. The parameter value description information of the target input parameter includes the target parameter value of the target input parameter, or includes a target reference field identifier for determining a target reference field containing the target parameter value. Based on the target parameter identifier and the parameter value description information, the target definition data of the target interface is generated; Based on the interface test request, obtain the corresponding target definition data, which includes: the target parameter identifier of the target input parameter, and the reference interface identifier corresponding to the target parameter identifier; In response to the fact that the target definition data does not include the target parameter value corresponding to the target parameter identifier, a matching target reference field is determined based on the target parameter identifier. The target reference field includes the target parameter identifier and the corresponding target parameter value. The target reference field is a field determined and stored by the target reference interface after performing interface testing in response to the reference interface test request. The target location information in the target reference field is determined from the target definition data; the target reference field includes at least one parameter sequence, each parameter sequence including a parameter identifier and at least one parameter value corresponding to the parameter identifier, the at least one parameter value is arranged in a preset order, the at least one parameter sequence includes a target parameter sequence, the parameter identifier in the target parameter sequence is the same as the target parameter identifier; the target location information includes the target parameter identifier, and the target sequence number of the target parameter value in the at least one parameter value of the target parameter sequence; The target parameter sequence is determined from the at least one parameter sequence based on the target parameter identifier; Based on the target sequence number, the target parameter value is determined from at least one parameter value in the target parameter sequence; The target interface is tested based on the target parameter values.

2. The method according to claim 1, characterized in that, Before determining the matching target reference field based on the target parameter identifier, in response to the target definition data not including the target parameter value corresponding to the target parameter identifier, the method further includes: Determine whether the target definition data includes the target parameter value corresponding to the target parameter identifier.

3. The method according to claim 2, characterized in that, Determining whether the target definition data includes the target parameter value corresponding to the target parameter identifier includes: Determine whether the target parameter value in the target definition data that corresponds to the target parameter identifier is empty; If it is determined that the value is not empty, then it is determined that the target definition data contains the target parameter value corresponding to the target parameter identifier; If it is determined to be empty, then it is determined that the target definition data does not contain the target parameter value corresponding to the target parameter identifier.

4. The method according to claim 2, characterized in that, Determining whether the target definition data includes the target parameter value corresponding to the target parameter identifier includes: Determine whether the target reference interface identifier, which corresponds to the target parameter identifier, in the target definition data is empty; If it is determined to be empty, then it is determined that the target definition data contains the target parameter value corresponding to the target parameter identifier; If it is determined that the value is not empty, then it is determined that the target definition data does not contain the target parameter value corresponding to the target parameter identifier.

5. The method according to claim 1, characterized in that, The step of determining the matching target reference field based on the target parameter identifier includes: From the target definition data, determine the target reference field identifier of the target reference field corresponding to the target parameter identifier; The target reference field corresponding to the target reference field identifier is determined from at least one pre-stored reference field; the at least one pre-stored reference field is determined from the response data obtained from the server after at least one test interface is tested and stored in a preset database.

6. The method according to claim 5, characterized in that, The target reference field identifier includes the target reference interface identifier of the target reference interface; Determining the target reference field corresponding to the target reference field identifier from at least one pre-stored reference field includes: Search the preset database for reference fields that correspond to the target reference interface identifier; The reference fields that correspond to the target reference interface identifier are identified as the target reference fields.

7. An interface testing apparatus, wherein the interface testing apparatus is used to implement the interface testing method according to any one of claims 1-6, characterized in that, The device includes: The receiving module is used to receive interface test requests for the target interface; The first acquisition module is used to acquire the corresponding target definition data based on the interface test request. The target definition data includes: the target parameter identifier of the target input parameter. The first determining module is used to determine a matching target reference field based on the target parameter identifier in response to the target definition data not including the target parameter value corresponding to the target parameter identifier. The target reference field includes the target parameter identifier and the corresponding target parameter value. The target reference field is a field determined and stored by the target reference interface after performing interface testing in response to the reference interface test request. The second acquisition module is used to obtain the target parameter value based on the target reference field; The testing module is used to perform interface testing on the target interface based on the target parameter values.

8. An interface testing device, comprising: A processor, a memory communicatively connected to the processor, and a transceiver; The memory stores computer-executed instructions; The transceiver is used to send and receive target data; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the interface testing method as described in any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Interface automatic test method and device, computer equipment and storage medium

    CN112052182A

  • Interface testing method and device

    CN113515436A