CN115509941A - Data interface testing method and device - Google Patents

Data interface testing method and device Download PDF

Info

Publication number
CN115509941A
CN115509941A CN202211319356.2A CN202211319356A CN115509941A CN 115509941 A CN115509941 A CN 115509941A CN 202211319356 A CN202211319356 A CN 202211319356A CN 115509941 A CN115509941 A CN 115509941A
Authority
CN
China
Prior art keywords
value
test
input
data interface
input parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211319356.2A
Other languages
Chinese (zh)
Inventor
王闪闪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211319356.2A priority Critical patent/CN115509941A/en
Publication of CN115509941A publication Critical patent/CN115509941A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the technical field of data processing, and provides a method and a device for testing a data interface. The method comprises the following steps: acquiring an interface document from a data interface; determining boundary values of the input parameters according to the input fields of the input parameters specified in the interface document; determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case to test the data interface according to the test value of at least one input parameter, and acquiring a test execution result; the input field is used for limiting the numerical value interval of the input parameters; the boundary value is at least one of a maximum value and a minimum value in the input domain. The test method of the data interface provided by the embodiment of the application can improve the test efficiency of the data interface.

Description

Data interface testing method and device
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for testing a data interface.
Background
In order to ensure the normal operation of the data processing system, the data interface of the system needs to be tested, which mainly tests the interaction points between the external system and the local system and between the subsystems of the local system, and detects whether there is an error in the interaction, transmission, control and management processes of data and the logical dependency relationship between the systems. In the related art, the test of the data interface is to test the data interface by inputting different test cases, such as different parameter values. However, as the number of data interfaces increases, a large number of parameter values are required to test the data interfaces, so that the time cost of the test is greatly increased, and the test efficiency is reduced.
Disclosure of Invention
The present application is directed to solving at least one of the technical problems occurring in the related art. Therefore, the application provides a test method of the data interface, which can improve the test efficiency of the data interface.
The application also provides a testing device of the data interface.
The application also provides an electronic device.
The present application also provides a computer-readable storage medium.
According to the test method of the data interface of the embodiment of the first aspect of the application, the method comprises the following steps:
acquiring an interface document from a data interface;
determining the boundary value of each input parameter according to the input field of each input parameter appointed in the interface document;
determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case according to the test value of at least one input parameter, testing the data interface, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
According to the data interface testing method, the boundary value of the input parameter is quickly determined through the interface document of the data interface, the characteristic that a large number of errors often occur on the boundary of an input or output range is utilized, the test value of the input parameter is determined according to the boundary value, and the test case is generated according to the test value to test the data interface, so that the test value on the boundary can be quickly obtained to test the data interface, all parameter values are not required to be exhausted during testing, the time cost of testing is greatly reduced, and the testing efficiency of the data interface is improved.
According to one embodiment of the present application, determining a test value of the input parameter based on the boundary value of the input parameter includes:
determining a first target value outside the input domain and a second target value inside the input domain according to the boundary value of the input parameter;
and determining the boundary value, the first target value and the second target value as the test value of the input parameter.
According to an embodiment of the application, the first target value and the second target value are adjacent to the boundary value.
According to an embodiment of the present application, further comprising:
starting from the boundary value, acquiring a plurality of third target values in the input domain according to a preset value interval;
and determining each third target value as the test value of the input parameter.
According to an embodiment of the present application, starting from the boundary value, obtaining a plurality of third target values in the input domain according to a preset value interval includes:
determining the parameter type of the input parameter as a preset parameter type, and acquiring a plurality of third target values in the input domain according to a preset value interval from the boundary value;
the preset parameter type is a parameter type in which the probability of an error occurring inside the input domain is greater than a preset probability when a data interface test is performed.
According to an embodiment of the present application, generating a test case to test the data interface according to a test value of at least one of the input parameters, and obtaining a test execution result includes:
obtaining a correlation coefficient between the test values of any two input parameters;
and generating a test case according to the test values of any two input parameters of which the correlation coefficients reach the preset values to test the data interface, and acquiring a test execution result.
According to an embodiment of the present application, further comprising:
comparing the test execution result with a preset result to determine a test result;
and determining the preset result according to the test value of the input parameter for generating the test case.
The test device for the data interface according to the embodiment of the second aspect of the application comprises:
the interface document acquisition module is used for acquiring an interface document from the data interface;
the boundary value determining module is used for determining the boundary value of each input parameter according to the input field of each input parameter specified in the interface document;
the interface data testing module is used for determining a testing value of the input parameter according to the boundary value of the input parameter, generating a testing case according to the testing value of at least one input parameter, testing the data interface and acquiring a testing execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
The electronic device according to the third aspect of the present application includes a processor and a memory storing a computer program, and the processor implements the method for testing the data interface according to any of the above embodiments when executing the computer program.
The computer-readable storage medium according to the fourth aspect of the present application stores thereon a computer program, which when executed by a processor implements the method for testing a data interface according to any of the embodiments described above.
A computer program product according to an embodiment of the fifth aspect of the application, comprising: the computer program, when executed by a processor, implements a method of testing a data interface as described in any of the embodiments above.
One or more technical solutions in the embodiments of the present application have at least one of the following technical effects:
the boundary value of the input parameter is quickly determined through the interface document of the data interface, so that the characteristic that a large number of errors often occur on the boundary of an input or output range is utilized to determine the test value of the input parameter according to the boundary value, and a test case is generated according to the test value to test the data interface, so that the test value on the boundary can be quickly obtained to test the data interface, all parameter values are not required to be exhausted during testing, the time cost of testing is greatly reduced, and the testing efficiency of the data interface is improved.
Furthermore, the first target value outside the input domain and the second target value inside the input domain are determined through the boundary value of the input parameter, and the boundary value, the first target value and the second target value are determined as the test value of the input parameter, so that the boundary can be more comprehensively utilized to test the data interface through the boundary value and the parameter values inside and outside the input domain, and the accuracy of the test result is further improved.
Furthermore, a plurality of third target values are obtained in the input domain from the boundary value through presetting the value interval, so that the obtained test values are more comprehensive, and the accuracy of the test result can be further improved.
Furthermore, after the parameter type of the input parameter is determined to be the preset parameter type, a plurality of third target values are obtained in the input domain according to the preset value interval from the boundary value, so that only the parameter type with the probability of error occurring in the input domain being greater than the preset probability during the data interface test is subjected to the third target value extraction, and the test efficiency is prevented from being influenced by more test values of the input parameter without the third target value extraction.
Drawings
In order to more clearly illustrate the technical solutions in the present application or prior art, the drawings used in the embodiments or the description of the prior art are briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for testing a data interface according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart illustrating further details of determining test values of the test method for the data interface of FIG. 1 according to an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating further details of determining test values of the test method for the data interface of FIG. 2 according to an embodiment of the present application;
FIG. 4 is a schematic flowchart illustrating further details of obtaining a test execution result of the test method for the data interface of FIG. 1 according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a testing apparatus for a data interface according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without making any creative effort belong to the protection scope of the present application.
Hereinafter, the method and apparatus for testing a data interface provided in the embodiments of the present application will be described and explained in detail with several specific embodiments.
In an embodiment, a method for testing a data interface is provided, and the method is applied to a server and used for realizing the test of the data interface. The server can be an independent server or a server cluster formed by a plurality of servers, and can also be a cloud server for providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (content delivery network) and large data and artificial intelligence sampling point equipment.
As shown in fig. 1, the method for testing a data interface provided in this embodiment includes:
step 101, obtaining an interface document from a data interface;
102, determining a boundary value of each input parameter according to an input field of each input parameter specified in the interface document;
103, determining a test value of the input parameter according to the boundary value of the input parameter, so as to generate a test case for testing the data interface according to the test value of at least one input parameter, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
The boundary value of the input parameter is rapidly determined through the interface document of the data interface, the test value of the input parameter is determined according to the boundary value by utilizing the characteristic that a large number of errors often occur on the boundary of an input or output range, and a test case is generated according to the test value to test the data interface, so that the test value on the boundary can be rapidly obtained to test the data interface, all parameter values are not required to be exhausted during testing, the time cost of testing is greatly reduced, and the testing efficiency of the data interface is improved.
In one embodiment, the interface document of the data interface may be a document having a standard message format. For example, a document in JSON (JSON Object Notation) format. The interface document records the parameter types of the input parameters which can be received by the data interface and the input fields of the input parameters. For example, an interface document of a data interface a records types of input parameters a, b and c which can be received by the data interface a, input fields of the input parameters are respectively a >25, b is a positive integer, and 0-c-s-100. The interface document can be stored in a database of the terminal device where the data interface is located, and the server can access the data interface to obtain the interface document of the data interface from the database of the terminal device.
After the server obtains the interface document, the server may parse the interface document to obtain, from the interface document, input parameter types that may be received by the data interface a and input fields of the input parameters, and then determine boundary values of the input parameters according to the input fields of the input parameters specified in the interface document. Illustratively, the input parameters recorded in the interface document include a, b, and c, the input fields of the respective input parameters are a >25, b is a positive integer, and 0-cloth c-cloth 100, in which case it is determined that the boundary value of the input parameter a is 25, the boundary value of b is 1, and the boundary value of c is 0 and 100. It will be appreciated that the number of boundary values for an input parameter may be determined based on the number of endpoints for the input field for that input parameter. If the input field of the input parameter a is a >25, the end point is 25, that is, the number of the end points of the input field is 1; if the input fields of the input parameters a are 25-a-straw 100, the end points thereof are 25 and 100, and the number of the end points of the input fields is 2.
After the boundary value of each input parameter is determined, the processing test of the test interface on a single input parameter or a plurality of input parameters can be carried out. For the processing test of a single input parameter, the boundary value of the input parameter is used as a test value according to the input parameter to be tested of the test interface, the normal values of the other input parameters are selected, and then a test case is generated according to the values of the input parameters to test the data interface. Illustratively, the parameter types of the input parameters specified in the interface document are a, b and c, the input fields of the input parameters are a >25, b is a positive integer, and 0-n-c-n-100, respectively, and currently only the processing condition of the interface on the input parameters a needs to be tested, at this time, the value of a may be 25, that is, the test value of the input parameter a is 25, the input parameter b randomly takes a positive integer, and the input parameter c randomly takes a value from 0 to 100. After the test value of the input parameter a is obtained, the test value 25 of the input parameter a, and the values selected by the input parameter b and the input parameter c can be input to the data interface as test cases for testing.
Similarly, when only the test interface is needed to process the input parameter b, the value of b may be 1, that is, the test value of the input parameter b is 1, the input parameter a randomly takes a value larger than 25, and the input parameter c randomly takes a value from 0 to 100.
Similarly, for the processing test of a plurality of input parameters, the boundary value of each input parameter to be tested by the test interface is used as the test value, and the normal value is selected for the rest of the input parameters to generate the test case.
In addition to the boundary value, the parameter values around the boundary value may also affect the test result, so in order to further improve the accuracy of the test result, in an embodiment, as shown in fig. 2, determining the test value of the input parameter according to the boundary value of the input parameter includes:
step 201, determining a first target value outside the input domain and a second target value inside the input domain according to the boundary value of the input parameter;
step 202, determining the boundary value, the first target value and the second target value as the test value of the input parameter.
For example, if the input parameter is b, the boundary value is 1, and the corresponding input field is b is a positive integer, a parameter value smaller than the boundary value, such as a parameter value of 0 or-1, may be selected as the first target value. Meanwhile, a parameter value larger than the boundary value, such as a parameter value of 2 or 3, may be selected as the second target value.
After the first target value and the second target value are determined, the boundary value, the first target value and the second target value may be determined as the test values of the input parameters.
Illustratively, the parameter types of the input parameters specified in the interface document are a, b and c, the input fields of the input parameters are a >25, b is a positive integer, and 0-c-100, respectively, and the processing condition of the interface to the input parameter a currently needs to be tested, at this time, 24, 25 and 26 can be taken as the test value of the input parameter a, meanwhile, the input parameter b and the input parameter c are within the normal required range, such as the random positive integer of the input parameter b, and the input parameter c is within a value from 0 to 100. And then, combining the test value of any input parameter a, and the input parameter b and the input parameter c which are randomly obtained to form a test case.
The first target value outside the input domain and the second target value inside the input domain are determined through the boundary value of the input parameter, and the boundary value, the first target value and the second target value are determined as the test value of the input parameter, so that the boundary can be more comprehensively utilized to test the data interface through the boundary value and the parameter values inside and outside the input domain, and the accuracy of the test result is further improved.
To ensure that the data interface can be tested with a boundary, in an embodiment the first target value and the second target value are adjacent to the boundary value, i.e. parameter values just above and just below the boundary are selected to form the test value with the boundary value. If the input field of the input parameter a is a positive integer from 0 to 1000, the boundary values of the input parameter are 0 and 1000, the first target values are-1 and 1000, and the second target values are 1 and 999. Thus, a test value of-1, 0,1, 999, 1000, 1001 for input parameter a can be determined.
Because the first target value and the second target value are adjacent to the boundary value, the obtained test value can better cover the boundary of the input domain, so that the boundary can be more comprehensively utilized to test the data interface, and the accuracy of the test result is improved.
In order to better improve the accuracy of the test result considering that some errors may also occur within the input range, in an embodiment, as shown in fig. 3, the method further includes:
step 301, starting from the boundary value, obtaining a plurality of third target values in the input domain according to a preset value interval;
step 302, determining each third target value as a test value of the input parameter.
In an embodiment, after the boundary value, the first objective value and the second objective value are determined as the test values of the input parameter, the preset value interval may be further determined according to a neighborhood range near the input domain. The neighborhood range can be set according to actual conditions. And if a plurality of boundary values exist, sequentially acquiring a plurality of third target values from the input domain according to a preset value interval by taking the minimum boundary value as a starting point. Illustratively, the input field is a positive integer of 0 to 1000, and the field range is 0 to 100, at this time, the maximum value of the field range is determined as the preset value interval, and values are taken every 100 starting from the boundary value 0, so as to obtain a plurality of third target values 99, 199, 299, and the like, respectively. And then, adding the acquired plurality of third target values into the test value of the input parameter.
And acquiring a plurality of third target values in the input domain from the boundary value by presetting the value interval, so that the acquired test values are more comprehensive, and the accuracy of the test result can be further improved.
It is considered that when the third target value is obtained to add the test value, the test efficiency is affected due to a large number of test values, and only a part of types of errors of the input parameters occur inside the input field. Therefore, in an embodiment, starting from the boundary value, a plurality of third target values are obtained in the input domain according to a preset value interval, including:
determining the parameter type of the input parameter as a preset parameter type, and acquiring a plurality of third target values in the input domain according to a preset value interval from the boundary value;
the preset parameter type is a parameter type in which the probability of an error occurring inside the input domain is greater than a preset probability when a data interface test is performed.
In an embodiment, the server stores a plurality of preset parameter types required to obtain the third target value in advance. After the boundary value, the first target value and the second target value are determined as the test values of the input parameters, the parameter types of the input parameters can be obtained, and then the parameter types are matched with all preset parameter types. If a preset parameter type which is the same as the parameter type exists, starting from the boundary value, and acquiring a plurality of third target values in the input domain according to a preset value interval; otherwise, the extraction of the third target value need not be performed. When the data interface test is performed through a large number of tests, the probability that an error of a certain parameter type occurs in the input domain is larger than the preset probability, and the parameter type is determined to be the preset parameter type. The preset probability can be determined according to actual conditions.
Illustratively, the preset parameter types pre-stored in the server are an input parameter a and an input parameter b, and if the parameter type of the input parameter is a, a plurality of third target values are obtained from the boundary value and in an early input domain according to a preset value interval; if the parameter type of the input parameter is c, the extraction of the third target value is not required.
After the parameter type of the input parameter is determined to be the preset parameter type, a plurality of third target values are obtained in the input domain from the boundary value according to the preset value interval, so that the third target values are extracted only for the parameter types with the probability of the error occurring in the input domain being greater than the preset probability when the data interface test is performed, and the test efficiency is prevented from being influenced by more test values of the input parameter without the need of extracting the third target values.
After the test values of the input parameters are obtained, the test case can be generated through the test values, and therefore the data interface is tested. In order to further improve the testing efficiency, in an embodiment, as shown in fig. 4, generating a test case according to a test value of at least one of the input parameters to perform a test on the data interface, and obtaining a test execution result includes:
step 401, obtaining a correlation coefficient between the input parameters;
step 402, generating a test case according to the test values of any two input parameters of which the correlation coefficients reach the preset values, testing the data interface, and obtaining a test execution result.
In one embodiment, after the input parameters are obtained from the interface document, the relevance of the input parameters in the interface document can be subjected to combined analysis. Specifically, by a correlation coefficient algorithm:
Figure BDA0003909675170000121
and determining a test value of the input parameter X and a test value correlation coefficient of the input parameter Y. Where Cov (X, Y) is the covariance of all the test values of the input parameter X and all the test values of the input parameter Y, V (X) is the variance of all the test values of the input parameter X, and V (Y) is the variance of all the test values of the input parameter Y.
After the correlation coefficient between the test values of the two input parameters is obtained, if the correlation coefficient reaches a preset value, the test values of the two input parameters are strongly boundary correlated, and a test case is generated according to the test values of the two input parameters to test the data interface, so that comprehensive and proper coverage is achieved, redundant execution does not exist, and the test coverage condition after the combination of a plurality of input parameters is not omitted.
In an embodiment, after obtaining the test execution result, the method further includes:
comparing the test execution result with a preset result to determine a test result;
and determining the preset result according to the test value of the test case.
Illustratively, the parameter types of the input parameters specified in the interface document are a, b and c types, the input field of the input parameter a is a >25, and if the test value of the input parameter a in the test case is 26, the preset result is a test error. After the test execution result is obtained, if the test execution result is the same as the preset result, the test execution result is a test error, and the test result is determined to be accurate; otherwise, determining that the test result is a test execution result error.
The following describes a test apparatus for a data interface provided in the present application, and the test apparatus for a data interface described below and the test method for a data interface described above may be referred to in correspondence with each other.
In one embodiment, as shown in fig. 5, there is provided a test apparatus for a data interface, including:
an interface document obtaining module 210, configured to obtain an interface document from a data interface;
a boundary value determining module 220, configured to determine a boundary value of each input parameter according to an input field of each input parameter specified in the interface document;
the interface data testing module 230 is configured to determine a test value of the input parameter according to the boundary value of the input parameter, generate a test case according to the test value of at least one input parameter, perform a test on the data interface, and obtain a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
The boundary value of the input parameter is quickly determined through the interface document of the data interface, so that the characteristic that a large number of errors often occur on the boundary of an input or output range is utilized to determine the test value of the input parameter according to the boundary value, and a test case is generated according to the test value to test the data interface, so that the test value on the boundary can be quickly obtained to test the data interface, all parameter values are not required to be exhausted during testing, the time cost of testing is greatly reduced, and the testing efficiency of the data interface is improved.
In an embodiment, the interface data testing module 230 is specifically configured to:
determining a first target value outside the input domain and a second target value inside the input domain according to the boundary value of the input parameter;
and determining the boundary value, the first target value and the second target value as the test value of the input parameter.
In an embodiment, the first target value and the second target value are adjacent to the boundary value.
In one embodiment, the interface data testing module 230 is further configured to:
starting from the boundary value, acquiring a plurality of third target values in the input domain according to a preset value interval;
and determining each third target value as the test value of the input parameter.
In an embodiment, the interface data testing module 230 is specifically configured to:
determining the parameter type of the input parameter as a preset parameter type, and acquiring a plurality of third target values in the input domain according to a preset value interval from the boundary value;
the preset parameter type is a parameter type in which the probability of an error occurring inside the input domain is greater than a preset probability when a data interface test is performed.
In an embodiment, the interface data testing module 230 is specifically configured to:
obtaining a correlation coefficient between the test values of any two input parameters;
and generating a test case according to the test values of any two input parameters of which the correlation coefficients reach the preset values to test the data interface, and acquiring a test execution result.
In one embodiment, the interface data testing module 230 is further configured to:
comparing the test execution result with a preset result to determine a test result;
and determining the preset result according to the test value of the input parameter for generating the test case.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor) 810, a Communication Interface 820, a memory 830 and a Communication bus 840, wherein the processor 810, the Communication Interface 820 and the memory 830 communicate with each other via the Communication bus 840. The processor 810 may call the computer program in the memory 830 to perform a method of testing a data interface, including, for example:
acquiring an interface document from a data interface;
determining the boundary value of each input parameter according to the input field of each input parameter specified in the interface document;
determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case according to the test value of at least one input parameter, testing the data interface, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, an embodiment of the present application further provides a storage medium, where the storage medium includes a computer program, where the computer program may be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer is capable of performing the method for testing the data interface provided in the foregoing embodiments, for example, including:
acquiring an interface document from a data interface;
determining the boundary value of each input parameter according to the input field of each input parameter specified in the interface document;
determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case according to the test value of at least one input parameter, testing the data interface, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
On the other hand, embodiments of the present application further provide a processor-readable storage medium, where a computer program is stored, and the computer program is configured to enable a processor to execute the method provided in the foregoing embodiments, for example, the method includes:
acquiring an interface document from a data interface;
determining the boundary value of each input parameter according to the input field of each input parameter appointed in the interface document;
determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case according to the test value of at least one input parameter, testing the data interface, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
The processor-readable storage medium may be any available medium or data storage device that can be accessed by a processor, including, but not limited to, magnetic memory (e.g., floppy disks, hard disks, magnetic tape, magneto-optical disks (MOs), etc.), optical memory (e.g., CDs, DVDs, BDs, HVDs, etc.), and semiconductor memory (e.g., ROMs, EPROMs, EEPROMs, non-volatile memories (NAND FLASH), solid State Disks (SSDs)), etc.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method for testing a data interface, comprising:
acquiring an interface document from a data interface;
determining the boundary value of each input parameter according to the input field of each input parameter appointed in the interface document;
determining a test value of the input parameter according to the boundary value of the input parameter, generating a test case according to the test value of at least one input parameter, testing the data interface, and acquiring a test execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
2. The method for testing a data interface of claim 1, wherein determining the test value of the input parameter based on the boundary value of the input parameter comprises:
determining a first target value outside the input domain and a second target value inside the input domain according to the boundary value of the input parameter;
and determining the boundary value, the first target value and the second target value as the test value of the input parameter.
3. The method for testing a data interface of claim 2, wherein the first target value and the second target value are adjacent to the boundary value.
4. The method for testing a data interface of claim 2, further comprising:
starting from the boundary value, acquiring a plurality of third target values in the input domain according to a preset value interval;
determining each of the third target values as a test value of the input parameter.
5. The method for testing the data interface according to claim 4, wherein obtaining a plurality of third target values in the input field according to a preset value interval from the boundary value comprises:
determining the parameter type of the input parameter as a preset parameter type, and acquiring a plurality of third target values in the input domain according to a preset value interval from the boundary value;
the preset parameter type is a parameter type in which the probability of an error occurring inside the input domain is greater than a preset probability when a data interface test is performed.
6. The method according to claim 1, wherein generating a test case to test the data interface according to the test value of at least one of the input parameters, and obtaining a test execution result includes:
obtaining a correlation coefficient between the test values of any two input parameters;
and generating a test case to test the data interface according to the test values of any two input parameters of which the correlation coefficients reach the preset value, and acquiring a test execution result.
7. The method for testing a data interface of any one of claims 1-6, further comprising:
comparing the test execution result with a preset result to determine a test result;
and determining the preset result according to the test value of the input parameter for generating the test case.
8. A device for testing a data interface, comprising:
the interface document acquisition module is used for acquiring an interface document from the data interface;
a boundary value determining module, configured to determine a boundary value of each input parameter according to an input field of each input parameter specified in the interface document;
the interface data testing module is used for determining a testing value of the input parameter according to the boundary value of the input parameter, generating a testing case according to the testing value of at least one input parameter, testing the data interface and acquiring a testing execution result;
wherein the input field is used for limiting the value interval of the input parameter;
the boundary value is at least one of a maximum value and a minimum value in the input domain.
9. An electronic device comprising a processor and a memory storing a computer program, wherein the processor implements the method for testing the data interface of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of testing a data interface according to any one of claims 1 to 7.
CN202211319356.2A 2022-10-26 2022-10-26 Data interface testing method and device Pending CN115509941A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211319356.2A CN115509941A (en) 2022-10-26 2022-10-26 Data interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211319356.2A CN115509941A (en) 2022-10-26 2022-10-26 Data interface testing method and device

Publications (1)

Publication Number Publication Date
CN115509941A true CN115509941A (en) 2022-12-23

Family

ID=84512698

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211319356.2A Pending CN115509941A (en) 2022-10-26 2022-10-26 Data interface testing method and device

Country Status (1)

Country Link
CN (1) CN115509941A (en)

Similar Documents

Publication Publication Date Title
CN112003870B (en) Network encryption traffic identification method and device based on deep learning
CN109800258B (en) Data file deployment method, device, computer equipment and storage medium
CN108734304B (en) Training method and device of data model and computer equipment
JP6689283B2 (en) Method and apparatus for assigning device fingerprints to internet devices
CN115174231B (en) Network fraud analysis method and server based on AI Knowledge Base
CN107911397B (en) Threat assessment method and device
CN110570544A (en) method, device, equipment and storage medium for identifying faults of aircraft fuel system
CN113986693A (en) Alarm response level determination method and device, electronic equipment and storage medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN115509941A (en) Data interface testing method and device
CN110912779A (en) Cluster host health detection method, system, equipment and readable storage medium
CN111736848B (en) Packet conflict positioning method, device, electronic equipment and readable storage medium
CN115643044A (en) Data processing method, device, server and storage medium
CN112295216B (en) Method, system, electronic device and storage medium for analyzing time delay disconnection of player
CN111143644B (en) Identification method and device of Internet of things equipment
CN114297735A (en) Data processing method and related device
CN113297149A (en) Method and device for monitoring data processing request
CN114338846A (en) Message testing method and device
CN112506736B (en) Method and device for monitoring open state of office file
CN116781389B (en) Determination method of abnormal data list, electronic equipment and storage medium
CN113836012B (en) Algorithm testing method and device, electronic equipment and storage medium
CN116708008A (en) Method for determining malicious files in transformer substation system, electronic equipment and storage medium
CN116757293A (en) Model correction method, device, equipment and storage medium
CN118093383A (en) Method and device for testing override vulnerability of software interface and electronic equipment
CN115344465A (en) Method, device and equipment for detecting abnormity of log and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination