Interface testing method, device, processor and electronic equipment

By obtaining and updating parameter values ​​in the parameter call file and associated file during interface testing, the inefficiency caused by parameter definition variables in interface testing is resolved, achieving more efficient interface testing.

CN116089191BActive Publication Date: 2026-06-09CAXA TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CAXA TECH
Filing Date
2023-01-17
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, interface testing requires defining a large number of variable parameters, which leads to low testing efficiency.

Method used

By receiving the interface test request of the business process to be tested, we determine the multiple logical interfaces that need to be tested and obtain the parameter call file; according to the test order, we determine whether each logical interface has the parameters that need to be called, obtain the parameter name and read the target parameter value from the associated file, update the parameter value in the interface test request, and execute the interface test.

Benefits of technology

It improves the efficiency of interface testing, reduces the need for a large number of parameter definition variables, and simplifies the testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116089191B_ABST
    Figure CN116089191B_ABST
Patent Text Reader

Abstract

The application discloses an interface test method and device, a processor and electronic equipment. The method comprises the following steps: receiving an interface test request of a to-be-tested business process, determining a plurality of logical interfaces that need to be tested in the to-be-tested business process, and obtaining a parameter calling file; judging whether each logical interface has a parameter that needs to be called in the parameter calling file according to a test sequence of the to-be-tested business process; in the case that the parameter calling file has a parameter that needs to be called by the current logical interface, obtaining the parameter names of a plurality of parameters that need to be called by the current logical interface; reading a target parameter value in an associated file of the to-be-tested business process according to the parameter name, replacing the parameter value corresponding to the parameter name in the interface test request with the target parameter value; and performing interface test of the current logical interface according to the interface test request after the parameter value is updated. Through the application, the problem that a large number of parameters need to be defined as variables during interface test in the related art, resulting in low test efficiency, is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of interface testing, and more specifically, to an interface testing method, apparatus, processor, and electronic device. Background Technology

[0002] To ensure the quality of enterprise information product releases, many companies employ interface testing, making it a crucial aspect of IT industry interface testing. Interface testing assesses the functionality, performance, stability, and security of interfaces. It involves defining interfaces on the backend and importing automated testing code to complete the testing. In PLM (Product Lifecycle Management) projects, numerous interfaces require testing. These interfaces often have many interrelated parameters. For example, in complex application scenarios, a test request for one interface might require a specific field or part of the response message from another interface or multiple interfaces as a parameter, and these parameters are constantly changing. Alternatively, in an interface's request data, one or more values ​​might be randomly generated by the frontend before being sent to the backend. Therefore, for a single interface, exhaustive parameter testing can suffice. However, for interfaces with multiple interfaces within a business logic, complex business logic interfaces are inherent to the application logic, and there are dependencies, logical relationships, and security requirements between interfaces. Simply exhaustively enumerating interface parameters would be extremely time-consuming.

[0003] In related technologies, variables are defined programmatically or Excel files or YAML files are used as intermediaries for data exchange. However, when there are many parameters to be associated, multiple variables need to be defined. If there are dependencies between test cases, multiple variables need to be defined in multiple test cases. This makes it inconvenient to maintain, view, and debug the parameters. It also increases the workload for testers, adding a significant amount of time spent writing, debugging, and maintaining code.

[0004] There is currently no effective solution to the problem of low testing efficiency caused by the need to define a large number of parameter variables during interface testing in related technologies. Summary of the Invention

[0005] The main purpose of this application is to provide an interface testing method, apparatus, processor, and electronic device to solve the problem of low testing efficiency caused by the need to define a large number of parameter variables during interface testing in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, an interface testing method is provided. The method includes: receiving an interface testing request for a business process under test; determining multiple logical interfaces that need to be tested in the business process under test; and obtaining a parameter call file for storing parameters of the multiple logical interfaces; sequentially determining whether each logical interface has parameters that need to be called in the parameter call file according to the testing order of the business process under test; if the parameter call file contains parameters that need to be called by the current logical interface, obtaining the parameter names of the multiple parameters that need to be called by the current logical interface; reading the target parameter value from the associated file of the business process under test based on the parameter name, and replacing the parameter value corresponding to the parameter name in the interface testing request with the target parameter value, wherein the associated file is a file storing parameter names and target parameter values ​​according to a preset storage format; and executing the interface test of the current logical interface based on the interface testing request with the updated parameter value.

[0007] Optionally, after determining whether each logical interface has the required parameters in the parameter call file according to the test order of the business process under test, the method further includes: if the parameter required for the current logical interface does not exist in the parameter call file, determining whether there are dynamic parameters in the interface test request, wherein dynamic parameters are parameters that change in real time and need to be called by the logical interface; if there are dynamic parameters in the interface test request, reading the dynamic parameter data in the associated file according to the dynamic parameter name; replacing the parameter value corresponding to the dynamic parameter name in the interface test request with the dynamic parameter data; if there are no dynamic parameters in the interface test request, executing the interface test of the current logical interface according to the interface test request with the unupdated parameter value.

[0008] Optionally, obtaining the parameter call file for storing parameters of multiple logical interfaces includes: determining a set of parameters associated with each logical interface to obtain multiple sets of parameters, wherein each set of parameters includes interface input parameters and interface output parameters; determining the dependency relationship between the interface input parameters of each logical interface and the interface output parameters of other logical interfaces, wherein the other logical interfaces are interfaces other than the current logical interface among the multiple logical interfaces; and sorting the multiple sets of parameters in the parameter call file according to the dependency relationship to obtain a parameter call file arranged according to the test order of the business process under test.

[0009] Optionally, before obtaining the parameter names of the multiple parameters that the current logical interface needs to call, the method further includes: determining whether each parameter called by the current logical interface is an interface output parameter of another logical interface, wherein the other logical interfaces are interfaces other than the current logical interface among multiple logical interfaces; if the parameter is an interface output parameter of another logical interface, performing an interface test of the other logical interface, obtaining the output value of the interface output parameter, and writing the output value to the parameter call file, wherein the output value is the parameter value of the parameter called by the current logical interface; if the parameter is not an interface output parameter of another logical interface, generating the parameter value according to the preset parameter generation rule, and writing the generated value to the parameter call file, wherein the generated value is the parameter value of the parameter called by the current logical interface.

[0010] Optionally, before reading the target parameter value from the associated file of the business process under test based on the parameter name, the method further includes: obtaining the output value or generated value corresponding to each parameter name from the parameter call file; and writing the output value or generated value corresponding to the parameter name and the parameter name into the associated file in key-value pair format.

[0011] Optionally, reading the target parameter value from the associated file of the business process under test based on the parameter name includes: determining the sub-file corresponding to the parameter name from the associated file, and extracting the output value or generated value corresponding to the parameter name from the sub-file as the target parameter value; after the output value or generated value is extracted from the sub-file, clearing the data in the sub-file.

[0012] Optionally, determining the multiple logical interfaces that need to be tested in the business process under test includes: obtaining historical interface test records of various business processes, and determining the interface test records of the business process under test from the historical interface test records; determining the multiple logical interfaces that need to be tested in the business process under test from the interface test records of the business process under test.

[0013] To achieve the above objectives, according to another aspect of this application, an interface testing apparatus is provided. The apparatus includes: a receiving unit, configured to receive an interface testing request for a business process under test, determine multiple logical interfaces that need to be tested in the business process under test, and obtain a parameter call file for storing parameters of the multiple logical interfaces; a first judging unit, configured to judge, according to the testing order of the business process under test, whether each logical interface has parameters that need to be called in the parameter call file; a first obtaining unit, configured to obtain the parameter names of the multiple parameters that need to be called by the current logical interface if the parameter call file contains parameters that need to be called by the current logical interface; a first reading unit, configured to read the target parameter value from an associated file of the business process under test based on the parameter name, and replace the parameter value corresponding to the parameter name in the interface testing request with the target parameter value, wherein the associated file is a file storing parameter names and target parameter values ​​according to a preset storage format; and a first execution unit, configured to execute the interface test of the current logical interface according to the interface testing request with updated parameter values.

[0014] This application employs the following steps: receiving an interface test request for a business process under test; identifying multiple logical interfaces that need to be tested within the business process under test; and obtaining a parameter call file to store the parameters of these multiple logical interfaces. Following the test order of the business process under test, it checks whether each logical interface has the required parameters in the parameter call file. If the parameter call file contains the parameters required for the current logical interface, it obtains the parameter names of the multiple parameters required for the current logical interface. Based on the parameter names, it reads the target parameter values ​​from the associated file of the business process under test and replaces the parameter values ​​corresponding to the parameter names in the interface test request with the target parameter values. The associated file is a file storing parameter names and target parameter values ​​according to a preset storage format. The application then executes the interface test for the current logical interface based on the updated parameter values. This solves the problem of low test efficiency caused by defining numerous parameter variables during interface testing in related technologies. By pre-configuring the parameters required for each logical interface in the parameter call file and determining the relationship between the input and output parameters of each logical interface, the interface test efficiency is improved by directly calling the target parameter values ​​stored in the associated file to update the parameter values ​​in the interface test request during interface testing. Attached Figure Description

[0015] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0016] Figure 1 This is a flowchart of the interface testing method provided according to the embodiments of this application;

[0017] Figure 2 This is a schematic diagram of an optional interface testing method provided according to an embodiment of this application;

[0018] Figure 3 This is a schematic diagram of an interface testing apparatus provided according to an embodiment of this application;

[0019] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0024] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of the interface testing method provided according to the embodiments of this application, such as... Figure 1 As shown, the method includes the following steps:

[0025] Step S101: Receive the interface test request of the business process to be tested, determine the multiple logical interfaces that need to be tested in the business process to be tested, and obtain the parameter call file used to store the parameters of the multiple logical interfaces.

[0026] Specifically, the business process under test can be a business with a large number of interfaces that need to be tested. The parameter call file can be an Excel file, which stores the parameters of all interfaces that need to be tested in the business process under test. The parameter call file can store the parameters of interfaces from multiple business processes. Different business processes are written in different sheets in the Excel file, and the sheet name is the name of the business process.

[0027] Step S102: According to the test order of the business process to be tested, determine whether each logical interface has the parameters that need to be called in the parameter call file.

[0028] Specifically, the test order can be the order in which interfaces are called during the execution of the business process under test. For example, the business process under test might first call interface A to obtain the output parameters of interface A, and then call interface B to input the output parameters of interface A into interface B to obtain the output parameters of interface B. During the interface test execution of the business process under test, pre-programmed code reads the parameter call file, iterates through each line of data in the parameter call file, and checks whether there is a parameter in the `dicreqstkey` column of the parameter call file. If a parameter exists in the `dicreqstkey` column, it means that a certain logical interface in the parameter call file needs to call a parameter. If no parameter exists in the `dicreqstkey` column, it means that a logical interface in the parameter call file does not have the parameter it needs to call.

[0029] Step S103: If the parameter call file contains the parameters that the current logical interface needs to call, obtain the parameter names of the multiple parameters that the current logical interface needs to call.

[0030] Specifically, the current logical interface is the logical interface currently being tested in the test order. If there are parameters in the dicreqstkey column of the parameter call file, that is, if the current logical interface has parameters that need to be called in the parameter call file, the multiple parameters that the current logical interface needs to call are obtained from the parameter call file. If there are multiple parameters, they are separated by the $ symbol. The preset parameter call code will extract the parameter name of each parameter in the parameter call file according to the separation of the $.

[0031] Step S104: Read the target parameter value from the associated file of the business process to be tested according to the parameter name, and replace the parameter value corresponding to the parameter name in the interface test request with the target parameter value. The associated file is a file that stores the parameter name and target parameter value according to a preset storage format.

[0032] Specifically, the associated file can be a YAML (a configuration file type) file with a unified data structure, and the target parameter value can be the parameter value corresponding to the parameter name written in the associated file according to the key-value pair format. A pre-designed Python (a programming language) program implements read and write operations on the associated file. After obtaining the target parameter value, the Python program reads the target parameter value and replaces the parameter value corresponding to the parameter name in the interface test request with the target parameter value.

[0033] It should be noted that the parameter names and target parameter values ​​extracted from the parameter call file are displayed in the associated file according to the tree structure at the time of creation. The parameter names and target parameter values ​​are presented hierarchically, ensuring the visibility and rigor of the data, which can be directly accessed when needed. The tree structure can be a product tree structure. For example, creating a product category extracts relevant attribute information such as the product category name, code, and creator. Creating products under this product category extracts relevant attribute information such as product name and code. Creating assembly lines under these products extracts relevant attribute information. Creating components under these assemblies extracts relevant component information. Creating drawings under these components extracts relevant drawing information such as drawing version, status, and lifecycle.

[0034] Step S105: Execute the interface test of the current logical interface based on the interface test request after updating the parameter values.

[0035] Specifically, interface tests of the current logical interface are performed using a pre-written automated internet interface test program. This automated internet interface test program can be written using Pytest or other interface testing languages ​​or methodologies.

[0036] The interface testing method provided in this application receives an interface test request from a business process under test, determines multiple logical interfaces that need to be tested in the business process under test, and obtains a parameter call file for storing the parameters of multiple logical interfaces. It then checks whether each logical interface has the required parameters in the parameter call file according to the test order of the business process under test. If the parameter call file contains the parameters required for the current logical interface, it obtains the parameter names of the multiple parameters required for the current logical interface. Based on the parameter names, it reads the target parameter values ​​from the associated file of the business process under test and replaces the parameter values ​​corresponding to the parameter names in the interface test request with the target parameter values. The associated file is a file storing parameter names and target parameter values ​​according to a preset storage format. Finally, it executes the interface test of the current logical interface based on the updated interface test request. This solves the problem of low testing efficiency caused by defining variables for a large number of parameters during interface testing in related technologies. By pre-configuring the parameters required for each logical interface in the parameter call file and determining the relationship between the input and output parameters of each logical interface, the method directly calls the target parameter values ​​stored in the associated file to update the parameter values ​​in the interface test request during interface testing, thereby improving the testing efficiency of the interface test.

[0037] Some interfaces do not have the required parameters in the parameter call file. Therefore, it is necessary to determine whether dynamic parameters exist in the interface test request before executing the interface test. Optionally, in the interface testing method provided in this application embodiment, after determining whether each logical interface has the required parameters in the parameter call file according to the test order of the business process to be tested, the method further includes: if the parameter to be called by the current logical interface does not exist in the parameter call file, determining whether dynamic parameters exist in the interface test request, wherein dynamic parameters are real-time changing parameters that the logical interface needs to call; if dynamic parameters exist in the interface test request, reading the dynamic parameter data in the associated file according to the dynamic parameter name; replacing the parameter value corresponding to the dynamic parameter name in the interface test request with the dynamic parameter data; if dynamic parameters do not exist in the interface test request, executing the interface test of the current logical interface according to the interface test request with the unupdated parameter value.

[0038] Specifically, dynamic parameters refer to parameters in the interface test request whose values ​​need to be replaced. The associated file contains not only the output parameters of other interfaces that need to be called during the logical interface test, but also all parameters that need to be called in each interface, such as dynamic parameters. The interface test request contains all parameters for the current logical interface during testing. If the current logical interface does not have output parameters that need to be called from other logical interfaces, and there are no dynamic parameters whose values ​​need to be replaced, the interface test can be executed directly. If dynamic parameters exist, the parameter values ​​corresponding to the dynamic parameter names in the interface test request still need to be replaced with the dynamic parameter data. By determining whether dynamic parameters exist in the interface test request and executing the interface test according to the above method, the efficiency of interface testing is improved.

[0039] For example, the sample test case code for interface testing is as follows:

[0040]

[0041]

[0042] Optionally, in the interface testing method provided in this application embodiment, obtaining a parameter call file for storing parameters of multiple logical interfaces includes: determining a set of parameters associated with each logical interface to obtain multiple sets of parameters, wherein each set of parameters includes interface input parameters and interface output parameters; determining the dependency relationship between the interface input parameters of each logical interface and the interface output parameters of other logical interfaces, wherein the other logical interfaces are interfaces other than the current logical interface among the multiple logical interfaces; and sorting the multiple sets of parameters in the parameter call file according to the dependency relationship to obtain a parameter call file arranged according to the test order of the business process to be tested.

[0043] Specifically, based on the business process under test, identify each logical interface that needs to be tested, identify a set of parameters associated with each logical interface, analyze the interface input parameters, interface output parameters and the dependencies between the interface parameters of this set of parameters and the interface parameters of other logical interfaces, sort the logical interfaces involved in the interface testing of the business process under test according to the dependencies, design a parameter call file to store the interface parameters, compile the parameter input values ​​of the business process under test, and organize the parameter input values ​​and interface parameters and other data in a predetermined format to obtain the parameter call file.

[0044] For example, if the output parameter of interface A is an input parameter of interface B, it indicates that there is a dependency relationship between interface A and interface B. Therefore, interface A should be listed before interface B in the parameter call file.

[0045] Some interfaces have parameters with no dependencies. Optionally, in the interface testing method provided in this application embodiment, before obtaining the parameter names of multiple parameters that the current logical interface needs to call, the method further includes: determining whether each parameter called by the current logical interface is an interface output parameter of another logical interface, wherein the other logical interfaces are interfaces other than the current logical interface among multiple logical interfaces; if the parameter is an interface output parameter of another logical interface, performing interface testing on the other logical interface, obtaining the output value of the interface output parameter, and writing the output value into the parameter calling file, wherein the output value is the parameter value of the parameter called by the current logical interface; if the parameter is not an interface output parameter of another logical interface, generating the parameter value according to the preset parameter generation rule, and writing the generated value into the parameter calling file, wherein the generated value is the parameter value of the parameter called by the current logical interface.

[0046] Specifically, it determines whether the current logical interface's input parameters contain any dependent parameters, that is, whether the input parameters contain output parameters from other logical interfaces. If dependent parameters exist, the tests for other logical interfaces are executed first to obtain the output values ​​of the dependent interface's output parameters. These output values ​​are then written to the parameter call file for use by the current logical interface. If no dependent parameters exist, the generated values ​​are created according to the preset generation rules for parameters without dependencies, and these generated values ​​are written to the parameter call file for use by the current logical interface.

[0047] Interface testing requires calling the necessary parameters from the associated file. Optionally, in the interface testing method provided in this application embodiment, before reading the target parameter value in the associated file of the business process to be tested according to the parameter name, the method further includes: obtaining the output value or generated value corresponding to each parameter name from the parameter calling file; and writing the output value or generated value corresponding to the parameter name and the parameter name into the associated file in the format of key-value pairs.

[0048] Specifically, the associated file can be a YAML file (Object Serialization Configuration File). This file is used to invoke parameters during API testing. The associated file uses a pre-defined programming method to store the parameter name and corresponding value of each parameter in a key-value pair format, following a YAML data structure. By storing the parameter name and value of each parameter from the parameter call file into the associated file as key-value pairs, the efficiency of retrieving parameter values ​​during API testing is improved.

[0049] For example, when there are parameters in the Dicreqstkey column of the parameter call file, that is, when the parameter call file stores the parameters that need to be called during interface testing, the parameter name in the dicreqstkey column is automatically used as the key and the parameter value corresponding to the parameter name is used as the value according to the preset code, and the key and value of the parameter are automatically written into the associated file (connection.yaml).

[0050] It should be noted that the reference code for writing and reading data from the associated file is as follows:

[0051]

[0052]

[0053] To save storage space in associated files, it is necessary to clear the files that have been called in the associated files in a timely manner. Optionally, in the interface testing method provided in this application embodiment, reading the target parameter value in the associated file of the business process to be tested according to the parameter name includes: determining the sub-file corresponding to the parameter name in the associated file, and extracting the output value or generated value corresponding to the parameter name from the sub-file as the target parameter value; after the output value or generated value in the sub-file is extracted, clearing the data in the sub-file.

[0054] Specifically, a subfile is a file in the associated file that stores the parameter name and parameter value of a parameter in key-value pairs. When performing interface testing, the subfiles corresponding to the parameters required by the interface being tested are called one by one in the associated file. After the subfile is called, a custom encapsulation function is called through preset code to clear the contents of the subfile in order to save storage space in the associated file.

[0055] It should be noted that when the interface test cases are executed, the system checks in real time whether the dynamic parameters in the request body have been replaced to determine whether the parameters to be called have been called. The dynamic parameters in the request body are replaced using the format {{parameter name}}. The default code will pass the parameters in the associated file, i.e. the values ​​corresponding to the keys, to the {{parameter name}} in the request body during runtime, and iterates through them until there are no more dynamic parameters using {{parameter name}} in the request body.

[0056] Different business processes require different logical interfaces to be tested. Optionally, in the interface testing method provided in this application embodiment, determining the multiple logical interfaces that need to be tested for the business process under test includes: obtaining historical interface test records of various business processes, and determining the interface test records of the business process under test from the historical interface test records; determining the multiple logical interfaces that need to be tested for the business process under test from the interface test records of the business process under test.

[0057] Specifically, since each company has multiple business processes that require interface testing, in order to create parameter call files that facilitate interface testing for various processes, the logical interfaces that need to be called by different business processes are first determined from historical interface test records. Then, multiple sets of logical interfaces corresponding to various business processes are stored in different sheets of the parameter call file. This allows for efficient determination of the parameters required for each interface test when facing different business processes.

[0058] According to another embodiment of this application, an optional interface testing method is provided. Figure 2 This is a flowchart of an optional interface testing method provided according to an embodiment of this application. For example... Figure 2 As shown, the method includes:

[0059] Read the test data from the Excel file and check if there are any parameters in the Dicreqstkey and jsonkey columns. If there are no parameters, check if there are any dynamic parameters in the request body. If there are dynamic parameters, read the data from the associated file and replace the dynamic parameters that need to be replaced in the request. Repeat this process until all parameters are replaced, and then execute the interface test. If there are no dynamic parameters, execute the interface test directly.

[0060] If the `Dicreqstkey` and `jsonkey` columns contain parameters, retrieve the parameter names from these columns and continuously check if all parameter names have been retrieved. If so, read the data from the associated file, replace the positions of the dynamic parameters that need to be replaced in the request, and iterate through the list until all parameters are replaced. After replacement, execute the interface test. If the parameter names have not been retrieved, automatically generate dynamic variables of the required type for the front-end based on the parameters in `Dicreqstkey` according to the rules, and execute the interface test for the dependent interface based on the parameters in the `jsonkey` column. Extract the response message data according to the parameters in the `jsonkey` column, assign values ​​to the parameters in the `Dicreqstkey` column, write the parameters to the associated file in key-value pairs, read the data from the associated file, replace the positions of the dynamic parameters that need to be replaced in the request, and iterate through the list until all parameters are replaced. After replacement, execute the interface test.

[0061] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0062] This application also provides an interface testing apparatus. It should be noted that the interface testing apparatus of this application can be used to execute the interface testing method provided in this application. The interface testing apparatus provided in this application is described below.

[0063] Figure 3 This is a schematic diagram of an interface testing apparatus provided according to an embodiment of this application. For example... Figure 3 As shown, the device includes:

[0064] The receiving unit 10 is used to receive the interface test request of the business process under test, determine the multiple logical interfaces that need to be tested in the business process under test, and obtain the parameter call file used to store the parameters of the multiple logical interfaces.

[0065] The first judgment unit 20 is used to judge one by one whether each logical interface has the parameters that need to be called in the parameter call file according to the test order of the business process to be tested;

[0066] The first acquisition unit 30 is used to acquire the parameter names of multiple parameters that the current logical interface needs to call when the parameter call file contains the parameters that the current logical interface needs to call.

[0067] The first reading unit 40 is used to read the target parameter value in the associated file of the business process under test according to the parameter name, and replace the parameter value corresponding to the parameter name in the interface test request with the target parameter value. The associated file is a file storing parameter names and target parameter values ​​according to a preset storage format.

[0068] The first execution unit 50 is used to execute the interface test of the current logical interface based on the interface test request after updating the parameter values.

[0069] The interface testing apparatus provided in this application embodiment receives an interface testing request from a business process under test via a receiving unit 10, determines multiple logical interfaces that need to be tested in the business process under test, and obtains a parameter call file for storing parameters of the multiple logical interfaces; a first judgment unit 20 judges each logical interface in the parameter call file according to the testing order of the business process under test to determine whether there are parameters that need to be called in the parameter call file; a first acquisition unit 30, if there are parameters that need to be called in the current logical interface in the parameter call file, acquires the parameter names of the multiple parameters that need to be called in the current logical interface; and a first reading unit 40 reads the target parameter values ​​in the associated file of the business process under test according to the parameter names, and sends the interface testing request to the relevant file. The parameter values ​​corresponding to the parameter names in the file are replaced with the target parameter values. The associated file is a file that stores parameter names and target parameter values ​​according to a preset storage format. The first execution unit 50 executes the interface test of the current logical interface according to the interface test request after updating the parameter values. This solves the problem of low test efficiency caused by the need to define a large number of parameter variables during interface testing in related technologies. By configuring the parameters that each logical interface needs to call in advance in the parameter call file, the relationship between the input parameters and output parameters of each logical interface is determined. During interface testing, the target parameter values ​​stored in the associated file are directly called to update the parameter values ​​in the interface test request, thereby improving the test efficiency of interface testing.

[0070] Optionally, in the interface testing apparatus provided in this application embodiment, the apparatus further includes: a second judgment unit, configured to determine whether there are dynamic parameters in the interface test request when there are no parameters to be called by the current logical interface in the parameter call file, wherein the dynamic parameters are parameters that change in real time and need to be called by the logical interface; a second reading unit, configured to read dynamic parameter data from the associated file according to the dynamic parameter name when there are dynamic parameters in the interface test request; a replacement unit, configured to replace the parameter value corresponding to the dynamic parameter name in the interface test request with the dynamic parameter data; and a second execution unit, configured to execute the interface test of the current logical interface according to the interface test request with the unupdated parameter value when there are no dynamic parameters in the interface test request.

[0071] Optionally, in the interface testing apparatus provided in this application embodiment, the receiving unit 10 includes: a first determining module, used to determine a set of parameters associated with each logical interface to obtain multiple sets of parameters, wherein a set of parameters includes interface input parameters and interface output parameters; a second determining module, used to determine the dependency relationship between the interface input parameters of each logical interface and the interface output parameters of other logical interfaces, wherein the other logical interfaces are interfaces other than the current logical interface among multiple logical interfaces; and a sorting module, used to sort the multiple sets of parameters in a parameter calling file according to the dependency relationship to obtain a parameter calling file arranged according to the test order of the business process to be tested.

[0072] Optionally, in the interface testing apparatus provided in this application embodiment, the apparatus further includes: a third judgment unit, configured to judge whether each parameter called by the current logical interface is an interface output parameter of another logical interface, wherein the other logical interfaces are interfaces other than the current logical interface among a plurality of logical interfaces; a third execution unit, configured to execute interface testing of the other logical interface when the parameter is an interface output parameter of another logical interface, obtain the output value of the interface output parameter, and write the output value into a parameter call file, wherein the output value is the parameter value of the parameter called by the current logical interface; and a generation unit, configured to generate a generated value of the parameter according to a preset generation rule of the parameter when the parameter is not an interface output parameter of another logical interface, and write the generated value into a parameter call file, wherein the generated value is the parameter value of the parameter called by the current logical interface.

[0073] Optionally, in the interface testing apparatus provided in the embodiments of this application, the apparatus further includes: a second acquisition unit, used to acquire the output value or generated value corresponding to each parameter name from the parameter call file; and a writing unit, used to write the output value or generated value corresponding to the parameter name and the parameter name into an associated file in a key-value pair format.

[0074] Optionally, in the interface testing device provided in the embodiments of this application, the first reading unit 40 includes: a third determining module, which uses a sub-file corresponding to the parameter name from the associated file to extract the output value or generated value corresponding to the parameter name from the sub-file as the target parameter value; and a clearing module, which is used to clear the data in the sub-file after the output value or generated value in the sub-file is extracted.

[0075] Optionally, in the interface testing apparatus provided in this application embodiment, the receiving unit 10 includes: a third acquisition unit, used to acquire historical interface test records of various business processes, and determine the interface test records of the business process to be tested from the historical interface test records; and a determination unit, used to determine multiple logical interfaces that need to be tested in the business process to be tested from the interface test records of the business process to be tested.

[0076] The interface testing device includes a processor and a memory. The aforementioned receiving unit 10, first judgment unit 20, first acquisition unit 30, first reading unit 40, and first execution unit 50 are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to achieve the corresponding functions.

[0077] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and adjusting kernel parameters can improve the efficiency of interface testing.

[0078] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0079] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements an interface testing method.

[0080] This invention provides a processor for running a program, wherein the program executes an interface testing method during runtime.

[0081] like Figure 4 As shown, this embodiment of the invention provides an electronic device. Device 401 includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the following steps: an interface testing method. The device in this document can be a server, PC, PAD, mobile phone, etc.

[0082] This application also provides a computer program product that, when executed on a data processing device, is suitable for executing an initialization program having the following method steps: an interface testing method.

[0083] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0084] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0085] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0086] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0087] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0088] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0089] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0090] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0091] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0092] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. An interface testing method, characterized in that, include: Receive the interface test request of the business process to be tested, determine the multiple logical interfaces that need to be tested in the business process to be tested, and obtain the parameter call file used to store the parameters of the multiple logical interfaces; According to the test order of the business process under test, determine whether each logical interface has the parameters that need to be called in the parameter call file. The test order is the calling order of the interfaces when the business process under test is executed. If the parameter call file contains parameters that the current logical interface needs to call, obtain the parameter names of the multiple parameters that the current logical interface needs to call; Based on the parameter name, read the target parameter value from the associated file of the business process under test, and replace the parameter value corresponding to the parameter name in the interface test request with the target parameter value. The associated file is a file storing parameter names and target parameter values ​​in a preset storage format. Execute the interface test of the current logical interface based on the interface test request after updating the parameter values; After determining whether each logical interface has the required parameters in the parameter calling file according to the test order of the business process under test, the method further includes: If the parameter to be called by the current logical interface does not exist in the parameter call file, determine whether there are dynamic parameters in the interface test request, wherein the dynamic parameters are the parameters that the logical interface needs to call in real time and change. If the dynamic parameter exists in the interface test request, read the dynamic parameter data in the associated file according to the dynamic parameter name; Replace the parameter value corresponding to the dynamic parameter name in the interface test request with the dynamic parameter data; If the dynamic parameter is not present in the interface test request, the interface test of the current logical interface is executed based on the interface test request with the parameter value not updated.

2. The method according to claim 1, characterized in that, Obtaining the parameter call file used to store the parameters of the multiple logical interfaces includes: Determine a set of parameters associated with each of the logical interfaces to obtain multiple sets of parameters, wherein each set of parameters includes interface input parameters and interface output parameters; Determine the dependency relationship between the interface input parameters of each logical interface and the interface output parameters of other logical interfaces, wherein the other logical interfaces are interfaces other than the current logical interface among the plurality of logical interfaces; Based on the dependencies, the multiple sets of parameters are sorted in the parameter call file to obtain a parameter call file arranged according to the test order of the business process to be tested.

3. The method according to claim 1, characterized in that, Before obtaining the parameter names of the multiple parameters required by the current logical interface, the method further includes: Determine whether each parameter called by the current logical interface is an output parameter of another logical interface, wherein the other logical interfaces are interfaces other than the current logical interface among the plurality of logical interfaces; When the parameter is the interface output parameter of another logical interface, the interface test of the other logical interface is performed to obtain the output value of the interface output parameter, and the output value is written to the parameter call file, wherein the output value is the parameter value of the parameter called by the current logical interface; If the parameter is not an output parameter of another logical interface, the generated value of the parameter is generated according to the preset generation rule of the parameter, and the generated value is written to the parameter call file, wherein the generated value is the parameter value of the parameter called by the current logical interface.

4. The method according to claim 3, characterized in that, Before reading the target parameter value from the associated file of the business process under test based on the parameter name, the method further includes: Obtain the output or generated value corresponding to each parameter name from the parameter call file; Write the output value or generated value corresponding to the parameter name and the parameter name into the associated file in key-value pair format.

5. The method according to claim 1, characterized in that, Reading the target parameter value from the associated file of the business process under test based on the parameter name includes: Determine the sub-file corresponding to the parameter name from the associated file, and extract the output value or generated value corresponding to the parameter name from the sub-file as the target parameter value; After the output or generated values ​​in the sub-file are extracted, the data in the sub-file is cleared.

6. The method according to claim 1, characterized in that, The multiple logical interfaces that need to be tested in the business process under test include: Obtain historical interface test records for various business processes, and determine the interface test records for the business process to be tested from the historical interface test records; Identify the multiple logical interfaces that need to be tested for the business process under test from the interface test records of the business process under test.

7. An interface testing device, characterized in that, The device further includes: The receiving unit is used to receive the interface test request of the business process to be tested, determine the multiple logical interfaces that need to be tested in the business process to be tested, and obtain the parameter call file for storing the parameters of the multiple logical interfaces. The first judgment unit is used to determine whether each logical interface has parameters to be called in the parameter call file according to the test order of the business process under test, wherein the test order is the calling order of the interfaces when the business process under test is executed; The first acquisition unit is used to acquire the parameter names of multiple parameters that the current logical interface needs to call when the parameter call file contains parameters that the current logical interface needs to call. The first reading unit is used to read the target parameter value in the associated file of the business process under test according to the parameter name, and replace the parameter value corresponding to the parameter name in the interface test request with the target parameter value. The associated file is a file storing parameter names and target parameter values ​​according to a preset storage format. The first execution unit is used to execute the interface test of the current logical interface based on the interface test request after updating the parameter values; The device further includes: a second judgment unit, configured to determine whether there are dynamic parameters in the interface test request when the parameter call file does not contain the parameters required for the current logical interface to be called, wherein the dynamic parameters are the parameters that change in real time and are required for the logical interface to be called; a second reading unit, configured to read the dynamic parameter data in the associated file according to the dynamic parameter name when there are dynamic parameters in the interface test request; a replacement unit, configured to replace the parameter value corresponding to the dynamic parameter name in the interface test request with the dynamic parameter data; and a second execution unit, configured to execute the interface test of the current logical interface according to the interface test request with the unupdated parameter value when there are no dynamic parameters in the interface test request.

8. A processor, characterized in that, The processor is used to run a program, wherein the program executes the interface testing method according to any one of claims 1 to 6 when it runs.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the interface testing method according to any one of claims 1 to 6.