CN113434396A - Interface test method, device, equipment, storage medium and program product - Google Patents
Interface test method, device, equipment, storage medium and program product Download PDFInfo
- Publication number
- CN113434396A CN113434396A CN202110694441.6A CN202110694441A CN113434396A CN 113434396 A CN113434396 A CN 113434396A CN 202110694441 A CN202110694441 A CN 202110694441A CN 113434396 A CN113434396 A CN 113434396A
- Authority
- CN
- China
- Prior art keywords
- test
- parameter
- interface
- test data
- tested
- 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
Links
- 238000010998 test method Methods 0.000 title claims abstract description 50
- 238000012360 testing method Methods 0.000 claims abstract description 296
- 238000000034 method Methods 0.000 claims abstract description 62
- 238000004458 analytical method Methods 0.000 claims description 17
- 230000004044 response Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 9
- 238000005192 partition Methods 0.000 claims description 5
- 239000000047 product Substances 0.000 description 9
- 238000002474 experimental method Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 230000002159 abnormal effect Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000008676 import Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 238000013100 final test Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000010187 selection method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3664—Environments for testing or debugging software
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
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 provides an interface testing method, an interface testing device, interface testing equipment, a storage medium and a program product. The method comprises the following steps: acquiring a plurality of parameters of an interface to be tested, and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters; determining a test data set corresponding to each parameter according to a plurality of test methods, wherein the test data set comprises a representative value of the parameter and representative values of other values except the value; generating a test case according to the test data set corresponding to each parameter; and testing the interface to be tested by adopting the test case. Thus, the test efficiency is improved.
Description
Technical Field
The present application relates to testing technologies, and in particular, to a method, an apparatus, a device, a storage medium, and a program product for testing an interface.
Background
The interface test is a test for testing interfaces among system components, and is mainly used for detecting interaction points between an external system and a system and between internal subsystems.
When testing the interface, the user usually needs to obtain the test case in advance, and execute the test according to the test case. In the currently common interface testing method, a user generally imports an interface configuration file of an interface to be tested into a system, the system obtains a description of relevant parameters in the interface according to the interface configuration file, and generates a test case by a comprehensive experiment method for testing.
However, in this scheme using a comprehensive experimental method, all combinations of parameters of the interface need to be tested more than once, which results in too many tests, too much workload and low efficiency.
Disclosure of Invention
The application provides an interface testing method, device, equipment, storage medium and program product, which improve the testing efficiency.
In a first aspect, the present application provides an interface testing method, including:
acquiring a plurality of parameters of an interface to be tested, and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters;
determining a test data set corresponding to each parameter according to a plurality of test methods, wherein the test data set comprises a representative value of the parameter and representative values of other values except the value;
generating a test case according to the test data set corresponding to each parameter;
and testing the interface to be tested by adopting the test case.
In one embodiment, the determining the test data set corresponding to each parameter according to the plurality of test methods includes:
determining a test data subset corresponding to each test method in the plurality of test methods for each parameter;
determining a union of a plurality of test data subsets;
and removing the duplicate of the test data in the union set to obtain a test data set corresponding to each parameter.
In one embodiment, the test method includes an equivalence class partition method;
the determining a test data subset corresponding to each of the plurality of test methods includes:
dividing the value of each parameter by using an equivalence class division method according to a business rule to obtain an effective equivalence class and an ineffective equivalence class;
and respectively determining part of test data from the effective equivalence class and the ineffective equivalence class to obtain a test data subset corresponding to the equivalence class division method.
In one embodiment, the test method further comprises a boundary value analysis method;
the determining a test data subset corresponding to each of the plurality of test methods includes:
and determining boundary values of the effective equivalence classes to form test data subsets corresponding to the analytical method.
In an embodiment, the generating a test case of the interface to be tested according to the test data set corresponding to each parameter includes:
determining a Cartesian product corresponding to the test data set corresponding to each parameter to obtain a target test set corresponding to a plurality of parameters;
and respectively importing each element in the target test set into a preset template to obtain a test case of the interface to be tested.
In an embodiment, the testing the interface to be tested by using the test case includes:
generating a test message according to the message format of the interface to be tested and the test case;
and sending the test message to a target server according to the address of the interface to be tested so as to test the interface to be tested.
In one embodiment, the method further comprises:
receiving a response message sent by the target server;
and generating a test report according to the response message, wherein the test report comprises at least one of the response message, a test result or test time consumption.
In a second aspect, the present application provides an interface testing apparatus, comprising:
the device comprises an acquisition module, a test module and a control module, wherein the acquisition module is used for acquiring a plurality of parameters of an interface to be tested and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters;
a determining module, configured to determine, according to a plurality of test methods, a test data set corresponding to each parameter, where the test data set includes a representative value of a value of the parameter and representative values of other values except the value;
the generating module is used for generating a test case according to the test data set corresponding to each parameter;
and the test module is used for testing the interface to be tested by adopting the test case.
In one embodiment, the determining module is configured to:
determining a test data subset corresponding to each test method in the plurality of test methods for each parameter;
determining a union of a plurality of test data subsets;
and removing the duplicate of the test data in the union set to obtain a test data set corresponding to each parameter.
In one embodiment, the test method includes an equivalence class partition method;
the determination module is to:
dividing the value of each parameter by using an equivalence class division method according to a business rule to obtain an effective equivalence class and an ineffective equivalence class;
and respectively determining part of test data from the effective equivalence class and the ineffective equivalence class to obtain a test data subset corresponding to the equivalence class division method.
In one embodiment, the test method further comprises a boundary value analysis method;
the determination module is to:
and determining boundary values of the effective equivalence classes to form test data subsets corresponding to the analytical method.
In one embodiment, the generation module is configured to:
determining a Cartesian product corresponding to the test data set corresponding to each parameter to obtain a target test set corresponding to a plurality of parameters;
and respectively importing each element in the target test set into a preset template to obtain a test case of the interface to be tested.
In one embodiment, the test module is configured to include:
generating a test message according to the message format of the interface to be tested and the test case;
and sending the test message to a target server according to the address of the interface to be tested so as to test the interface to be tested.
In one embodiment, the apparatus further comprises:
and the report module is used for receiving a response message sent by the target server and generating a test report according to the response message, wherein the test report comprises at least one of the response message, a test result or test time consumption.
In a third aspect, the present application provides an electronic device, comprising: a memory and a processor; the memory is connected with the processor;
the memory is used for storing a computer program;
the processor is adapted to carry out the method as described in the above first aspect when the computer program is executed.
In a fourth aspect, the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method as described in the first aspect above.
In a fifth aspect, the present application provides a program product comprising program code which, when run on a computer, causes the computer to perform the method as described in the first aspect above.
The application provides an interface test method, a device, equipment, a storage medium and a program product, wherein a test data set corresponding to each parameter is determined through a plurality of test methods, and the test data set comprises a representative value of a value of the parameter and representative values of other values except the value; and generating a test case according to the test data set corresponding to each parameter, and on the premise of ensuring that the test case can be fully covered, not testing all parameter combinations of the interface, thereby improving the test efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a schematic view of a scenario of an interface testing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an interface testing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of 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, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, in the interface test, a method for obtaining a test is generally that a user imports an interface configuration file of an interface to be tested into a system, the system obtains an interface name, an interface call URL path, an interface request method, an interface request parameter list, an interface request parameter description and an interface return parameter description according to the interface configuration file, and then feeds back the interface request parameter description and the interface return parameter description to the user through a human-computer interaction interface. And then, configuring a test rule for each parameter in the interface request parameter list through a human-computer interaction interface by a user according to the interface request parameter description and the interface return parameter description. And respectively generating test cases by the system according to all test rules of all parameter fields through a comprehensive experiment method. The system respectively generates request messages of each interface according to the information in each generated test case, sends the request messages to the corresponding interface so as to execute each generated test case, then judges the execution result of the corresponding test case according to the actual return result of executing each test case and the expected result preset in the test rule of correspondingly generating each test case, and outputs the result of whether the test is successful or not.
In the scheme adopting the comprehensive experimental method, all combinations of parameters of the interface need to be tested more than once, so that the test times are too many, the workload is too large, and the efficiency is lower. Therefore, an orthogonal experiment method may be adopted in the process of generating the test case, and the orthogonal experiment method selects part of data from a comprehensive experiment according to orthogonality to perform testing, but the selection method depends on the experience of an actual worker, so that the test case cannot completely cover the requirement due to reasons such as insufficient experience of the actual worker, and risks such as missing testing of a scene are likely to occur.
In order to solve the above problems, in the embodiment of the present application, it is considered that a plurality of test methods are adopted to determine a test data set corresponding to each parameter, where the test data set includes a representative value of a value of the parameter and representative values of other values except the value, and the representative value in the test data set can represent all possible test results of the test parameter. Fig. 1 is a scene schematic diagram of an interface testing method according to an embodiment of the present application. As shown in fig. 1, the server 10 may be configured to execute the interface testing method provided in the embodiment of the present application, generate a test case, and send a test request to the target server 20 according to the test case to obtain a test result.
Hereinafter, the user positioning method provided in the present application will be described in detail by specific embodiments. It is to be understood that the following detailed description may be combined with other embodiments, and that the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a schematic flowchart of an interface testing method according to an embodiment of the present application. The execution subject of the method is an interface testing device, and the device can be realized by software and/or hardware. For example, the execution subject may be a server for performing the interface test. As shown in fig. 2, the method of the present embodiment includes:
s201, obtaining a plurality of parameters of the interface to be tested, and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters.
In this step, a plurality of parameters of the interface to be tested can be obtained from the interface document, the interface configuration file or the interface message. The server can analyze and obtain a system identifier, a protocol used by the interface to be tested, a name of the interface to be tested, a request method of the interface to be tested, a parameter access request list and type and a parameter access list from an interface document, an interface configuration file or an interface message. Wherein the system identification refers to the identification of the system to which the interface to be tested belongs. In this embodiment, the server may analyze a single interface to be tested to obtain parameters of the single interface to be tested, or may also analyze a plurality of interfaces to be tested to obtain parameters of each interface to be tested. In addition, the analysis result can be displayed through a user interface, so that a user can determine the parameters of the interface to be tested conveniently.
The parameter type of each parameter can be obtained from the above analysis result, for example, the parameter type can be bool, int, long, string, float, double, etc. For each parameter, the server may determine a possible value of the occurrence according to a parameter type of the parameter, for example, a pool type has two possible values, i.e., true and false, and an int type may be a value between-32768 and 32767.
Optionally, on the basis of the parameter types, the server may further determine a value of each parameter in combination with a service rule, and the service rule may be set by a user. For example, whether the parameter is a must-fill or a select-fill, whether the length of the parameter is limited, whether the parameter can be repeated, whether the value range of the parameter is limited, and the like may be specifically set according to an actual business rule. In this step, the value of each parameter refers to a normal value of the parameter that meets the parameter type and/or the service rule.
S202, determining a test data set corresponding to each parameter according to a plurality of test methods, wherein the test data set comprises representative values of the parameters and representative values of other values except the values.
The test method in this step refers to a test concept, such as an equivalence class division method and a boundary value method, and according to each test method, the test data of each parameter may be determined, and then the test data set corresponding to each parameter may be determined according to the test data determined by a plurality of test methods.
For each parameter, determining a test data subset corresponding to each test method in the plurality of test methods; determining a union of a plurality of test data subsets; and removing the duplicate of the test data in the union set to obtain a test data set corresponding to each parameter.
It should be noted that the data in the test data subset corresponding to each test method in the plurality of test methods may be representative values of some values and/or representative values of other values (i.e., abnormal values) other than the values of each parameter under the test method. The representative value of the value of each parameter can be used to test whether the function of the interface is correctly realized, and the representative values of other values except the value can be used to test whether the interface has normal abnormal processing capability.
After combining and de-duplicating the test data subsets corresponding to the plurality of test methods, the data in the obtained test data set includes the representative value of the value of each parameter and the representative values of other values except the value. The test result of the representative value of the value of each parameter included in the test data set may represent the test results of all the values, and the representative values of the other values except the values may represent the test results of all the abnormal values.
In addition, the test case corresponding to the abnormal value can be called a reverse case, and the test case corresponding to the parameter value can be called a forward case. And obtaining an expected result of the test case according to the forward and reverse attributes of the test case. In the embodiment of the application, the user can edit and set the specific expected result of each test case, so as to compare the expected result with the result after the test is executed. By the method, a forward and reverse minimum test case set with full coverage on requirements can be obtained.
And S203, generating a test case according to the test data set corresponding to each parameter.
After the test data set corresponding to each parameter is obtained, the representative values of each parameter may be combined to obtain the input-parameter representative value of the interface, and a test case is generated.
Optionally, determining a cartesian product corresponding to the test data set corresponding to each parameter to obtain a target test set corresponding to a plurality of parameters; and respectively importing each element in the target test set into a preset template to obtain a test case of the interface to be tested. Where the Cartesian product, also called the direct product, of the two sets X and Y, denoted X Y, refers to all possible ordered pairs where the first object is a member of X and the second object is a member of Y.
And performing Cartesian product calculation on the test data set corresponding to each parameter, so that all combinations of representative values of all parameters can be obtained, and the test case coverage comprehensiveness is ensured. In addition, when the test case is generated, a person is generally required to write in the related technology, and a large amount of repetitive work is performed, so that the corresponding export field of the template can be configured according to the requirement of the preset template in the step, and the generated test case is exported according to the template. Thereby greatly reducing the manual workload and improving the efficiency. And the test case generated according to the preset template can also provide a user editing and modifying function so as to optimize according to the actual evaluation of the user and obtain the final test case.
And S204, testing the interface to be tested by adopting the test case.
After the test case is generated, the interface needs to be tested according to the information such as parameters in the test case, that is, a test message is generated according to the message format of the interface to be tested and the test case; and sending a test message to the target server according to the address of the interface to be tested so as to test the interface to be tested. In addition, a response message sent by the target server can be received, and a test report is generated according to the response message, wherein the test report comprises at least one of the response message, a test result or test time consumption.
The system corresponding to each interface to be tested can configure a test address, namely the address of the interface to be tested, and the server assembles a message according to the address of the interface to be tested, a protocol used by the interface to be tested, a message format of the interface to be tested and a combination of the reference representative values in the test case and sends a request to the target server. In actual testing, the method of single-step debugging or batch execution of the test case can be adopted for testing. The single step debugging is to check the return message and the result of assertion of each test case in the process of executing the test cases one by one, for example, the single step debugging can be used when the test cases are run for the first time. The batch execution is to concurrently execute a plurality of test cases, the execution result of each test case is not shown in the execution process, and a detailed test report can be generated after the execution is finished to check the return message and the assertion result of each test case.
For the execution result of the test case, only the result of the execution success or failure is usually fed back in the related art, and in the embodiment of the present application, detailed result analysis is provided, including the success rate of execution, the total duration of execution, whether each test case is executed successfully or not, the execution time is consumed, the result is asserted, and the output display of each test packet is provided, so that an all-around execution result analysis report is provided for a user, and the problem of the test is conveniently checked.
Compared with a comprehensive test method and an orthogonal test method, the method for generating the test user can achieve comprehensive coverage of test requirements on one hand, and can achieve test effects produced by an exhaustive method by using a minimum test case set on the other hand, so that test efficiency is improved.
On the basis of the above embodiments, how to determine the test data set corresponding to each parameter is described.
In one embodiment, the test method includes an equivalence class partition. The equivalence class division method is to divide a range from a large amount of data (the test effect of the data in each range is equivalent, so each range is an equivalence class), and then select representative data from each range, wherein the representative data can reflect the test result of the data in the range.
When the corresponding test data subset is determined by adopting the equivalence class division method, the following method can be adopted: dividing the value of each parameter by using an equivalence class division method according to a business rule to obtain an effective equivalence class and an ineffective equivalence class; and respectively determining part of the test data from the effective equivalence class and the ineffective equivalence class to obtain the test data subsets corresponding to the equivalence class division method.
The valid equivalence class is a meaningful and reasonable input data set for a program, and is used for testing whether functions are correctly realized. Invalid equivalence classes refer to sets of input data that are meaningless and unreasonable to a program to test whether the program has strong exception handling capabilities.
In one embodiment, the test method includes a boundary value analysis method, which is a black box test method for testing an input or output boundary value. When the boundary value analysis method is used as a supplement to the equivalence class division method, the value of the test case may come from the boundary of the equivalence class in the boundary value analysis method. That is, boundary values for valid equivalence classes are determined to form a corresponding subset of test data for the analytical method.
For example, the parameter P is based on a possible value set of a parameter type, which is a1 ═ P1, P2. }, and if there is a business rule requirement for the parameter in demand, based on the business rule, a test method 1 is used to obtain a representative value set, i.e., a test data subset a2 ═ P3, P4. }, a test method 2 is used to obtain a representative value set, i.e., a test data subset A3 ═ P5, P6. }, and a test method n is used to obtain a representative value set, i.e., a test data subset An ═ pn,. }, then the representative value set of the parameter P, i.e., a test data set a2 ═ A3. # An. If the requirement does not impose the business rule restriction on the parameter, the representative value set of the parameter P is a-a 1. By analogy, test data sets A, B through N of all parameters of the interface can be obtained, and cartesian products are performed on the test data sets of the parameters to obtain a parameter-entering representative value set of the test case, which is C ═ a × B ×.
In the embodiment of the application, a test idea such as an equivalence class division method and a boundary value method is adopted, the method can be expanded to a plurality of analysis methods, a representative value set of parameters of each interface is obtained by combining service rules in corresponding requirements, a Cartesian product is carried out on the representative value set of each field, a test case set of each interface is obtained, and the test case set is a forward and reverse minimum test case set which covers requirements comprehensively, so that the test efficiency is improved.
Fig. 3 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present application. As shown in fig. 3, the interface test apparatus 30 includes:
an obtaining module 301, configured to obtain multiple parameters of an interface to be tested, and determine a value of each parameter according to a parameter type of each parameter in the multiple parameters;
a determining module 302, configured to determine, according to a plurality of test methods, a test data set corresponding to each parameter, where the test data set includes a representative value of a value of the parameter and representative values of other values except the value;
a generating module 303, configured to generate a test case according to the test data set corresponding to each parameter;
the test module 304 is configured to test the interface to be tested by using the test case.
In one embodiment, the determining module 302 is configured to:
determining a test data subset corresponding to each test method in the plurality of test methods for each parameter;
determining a union of a plurality of test data subsets;
and removing the duplicate of the test data in the union set to obtain a test data set corresponding to each parameter.
In one embodiment, the test method includes an equivalence class partition method;
the determination module 302 is configured to:
dividing the value of each parameter by using an equivalence class division method according to a business rule to obtain an effective equivalence class and an ineffective equivalence class;
and respectively determining part of the test data from the effective equivalence class and the ineffective equivalence class to obtain the test data subsets corresponding to the equivalence class division method.
In one embodiment, the test method further comprises a boundary value analysis method;
the determination module 302 is configured to:
boundary values of valid equivalence classes are determined to form test data subsets corresponding to the analytical methods.
In one embodiment, the generating module 303 is configured to:
determining a Cartesian product corresponding to the test data set corresponding to each parameter to obtain a target test set corresponding to a plurality of parameters;
and respectively importing each element in the target test set into a preset template to obtain a test case of the interface to be tested.
In one embodiment, the testing module 304 is configured to include:
generating a test message according to the message format and the test case of the interface to be tested;
and sending a test message to the target server according to the address of the interface to be tested so as to test the interface to be tested.
In one embodiment, the interface test apparatus 30 further comprises:
and the report module is used for receiving the response message sent by the target server and generating a test report according to the response message, wherein the test report comprises at least one of the response message, the test result or the test time consumption.
The apparatus of this embodiment may be configured to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 4, the electronic apparatus 40 includes: a memory 401 and a processor 402. Alternatively, the memory 401 and the processor 402 may be connected by a bus 403.
The memory 401 is used to store computer programs.
The processor 402 is adapted to implement the method in any of the embodiments described above when the computer program is executed.
The present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as in any of the above embodiments.
The present application provides a program product comprising program code which, when run on a computer, causes the computer to perform the method as in any of the embodiments described above.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting 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 or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.
Claims (11)
1. An interface testing method, comprising:
acquiring a plurality of parameters of an interface to be tested, and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters;
determining a test data set corresponding to each parameter according to a plurality of test methods, wherein the test data set comprises a representative value of the parameter and representative values of other values except the value;
generating a test case according to the test data set corresponding to each parameter;
and testing the interface to be tested by adopting the test case.
2. The method of claim 1, wherein determining the test data set corresponding to each parameter according to the plurality of test methods comprises:
determining a test data subset corresponding to each test method in the plurality of test methods for each parameter;
determining a union of a plurality of test data subsets;
and removing the duplicate of the test data in the union set to obtain a test data set corresponding to each parameter.
3. The method of claim 2, wherein the testing method comprises an equivalence class partition method;
the determining a test data subset corresponding to each of the plurality of test methods includes:
dividing the value of each parameter by using an equivalence class division method according to a business rule to obtain an effective equivalence class and an ineffective equivalence class;
and respectively determining part of test data from the effective equivalence class and the ineffective equivalence class to obtain a test data subset corresponding to the equivalence class division method.
4. The method of claim 3, wherein the test method further comprises a boundary value analysis method;
the determining a test data subset corresponding to each of the plurality of test methods includes:
and determining boundary values of the effective equivalence classes to form test data subsets corresponding to the analytical method.
5. The method according to any one of claims 1 to 4, wherein the generating a test case of the interface to be tested according to the test data set corresponding to each parameter includes:
determining a Cartesian product corresponding to the test data set corresponding to each parameter to obtain a target test set corresponding to a plurality of parameters;
and respectively importing each element in the target test set into a preset template to obtain a test case of the interface to be tested.
6. The method according to any one of claims 1-4, wherein the using the test case to test the interface to be tested comprises:
generating a test message according to the message format of the interface to be tested and the test case;
and sending the test message to a target server according to the address of the interface to be tested so as to test the interface to be tested.
7. The method of claim 6, further comprising:
receiving a response message sent by the target server;
and generating a test report according to the response message, wherein the test report comprises at least one of the response message, a test result or test time consumption.
8. An interface testing apparatus, comprising:
the device comprises an acquisition module, a test module and a control module, wherein the acquisition module is used for acquiring a plurality of parameters of an interface to be tested and determining the value of each parameter according to the parameter type of each parameter in the plurality of parameters;
a determining module, configured to determine, according to a plurality of test methods, a test data set corresponding to each parameter, where the test data set includes a representative value of a value of the parameter and representative values of other values except the value;
the generating module is used for generating a test case according to the test data set corresponding to each parameter;
and the test module is used for testing the interface to be tested by adopting the test case.
9. An electronic device, comprising: a memory and a processor; the memory is connected with the processor;
the memory is used for storing a computer program;
the processor is adapted to carry out the method according to any of the claims 1-7 when the computer program is executed.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of the claims 1-7.
11. Program product, comprising program code which, when run on a computer, causes the computer to carry out the method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110694441.6A CN113434396A (en) | 2021-06-22 | 2021-06-22 | Interface test method, device, equipment, storage medium and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110694441.6A CN113434396A (en) | 2021-06-22 | 2021-06-22 | Interface test method, device, equipment, storage medium and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113434396A true CN113434396A (en) | 2021-09-24 |
Family
ID=77757219
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110694441.6A Pending CN113434396A (en) | 2021-06-22 | 2021-06-22 | Interface test method, device, equipment, storage medium and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113434396A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115061916A (en) * | 2022-06-21 | 2022-09-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115242520A (en) * | 2022-07-25 | 2022-10-25 | 山石网科通信技术股份有限公司 | Security policy verification method and device, security gateway and storage medium |
CN117251298A (en) * | 2023-11-20 | 2023-12-19 | 广州嘉为科技有限公司 | Pipeline task cyclic execution method, system, equipment and medium |
CN117389908A (en) * | 2023-12-12 | 2024-01-12 | 深圳市铱云云计算有限公司 | Dependency analysis method, system and medium for interface automation test case |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110334009A (en) * | 2019-05-28 | 2019-10-15 | 中国平安人寿保险股份有限公司 | Automatic example generation method, device, terminal and storage medium |
CN110750442A (en) * | 2019-09-06 | 2020-02-04 | 平安医疗健康管理股份有限公司 | Test case generation method, device, equipment and storage medium |
CN111352782A (en) * | 2020-02-28 | 2020-06-30 | 北京字节跳动网络技术有限公司 | Interface testing method and device, computer equipment and storage medium |
CN112597018A (en) * | 2020-12-22 | 2021-04-02 | 未来电视有限公司 | Interface test case generation method, device, equipment and storage medium |
-
2021
- 2021-06-22 CN CN202110694441.6A patent/CN113434396A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110334009A (en) * | 2019-05-28 | 2019-10-15 | 中国平安人寿保险股份有限公司 | Automatic example generation method, device, terminal and storage medium |
CN110750442A (en) * | 2019-09-06 | 2020-02-04 | 平安医疗健康管理股份有限公司 | Test case generation method, device, equipment and storage medium |
CN111352782A (en) * | 2020-02-28 | 2020-06-30 | 北京字节跳动网络技术有限公司 | Interface testing method and device, computer equipment and storage medium |
CN112597018A (en) * | 2020-12-22 | 2021-04-02 | 未来电视有限公司 | Interface test case generation method, device, equipment and storage medium |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115061916A (en) * | 2022-06-21 | 2022-09-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115061916B (en) * | 2022-06-21 | 2024-07-16 | 中国平安财产保险股份有限公司 | Method for automatically generating interface test case and related equipment thereof |
CN115242520A (en) * | 2022-07-25 | 2022-10-25 | 山石网科通信技术股份有限公司 | Security policy verification method and device, security gateway and storage medium |
CN117251298A (en) * | 2023-11-20 | 2023-12-19 | 广州嘉为科技有限公司 | Pipeline task cyclic execution method, system, equipment and medium |
CN117251298B (en) * | 2023-11-20 | 2024-03-19 | 广州嘉为科技有限公司 | Pipeline task cyclic execution method, system, equipment and medium |
CN117389908A (en) * | 2023-12-12 | 2024-01-12 | 深圳市铱云云计算有限公司 | Dependency analysis method, system and medium for interface automation test case |
CN117389908B (en) * | 2023-12-12 | 2024-03-26 | 深圳市铱云云计算有限公司 | Dependency analysis method, system and medium for interface automation test case |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113434396A (en) | Interface test method, device, equipment, storage medium and program product | |
CN111538659B (en) | Interface testing method, system, electronic equipment and storage medium of business scene | |
CN109977012B (en) | Joint debugging test method, device, equipment and computer readable storage medium of system | |
CN111966597B (en) | Test data generation method and device | |
CN111258913A (en) | Automatic algorithm testing method and device, computer system and readable storage medium | |
CN111506298A (en) | Method for carrying out interface visual configuration based on JSON object | |
CN113590454A (en) | Test method, test device, computer equipment and storage medium | |
CN111045879A (en) | Pressure test report generation method and device and storage medium | |
CN114676066A (en) | Security testing method and device for target application, electronic equipment and storage medium | |
CN112395182A (en) | Automatic testing method, device, equipment and computer readable storage medium | |
EP3734460A1 (en) | Probabilistic software testing via dynamic graphs | |
CN110888800A (en) | Service interaction function test method, device, storage medium and test system | |
CN113254350A (en) | Flink operation testing method, device, equipment and storage medium | |
CN113297078A (en) | MOCK system and data testing method based on MOCK system | |
CN116702668A (en) | Regression testing method and device, electronic equipment and storage medium | |
CN116126719A (en) | Interface testing method and device, electronic equipment and storage medium | |
WO2023014282A1 (en) | Device and method for automated generation of parameter testing requests | |
CN113935847A (en) | Online process risk processing method, device, server and medium | |
CN114741162A (en) | Service arranging method, device, storage medium and equipment | |
CN104142885A (en) | Method and device for carrying out abnormality test on tested program | |
CN113806231A (en) | Code coverage rate analysis method, device, equipment and medium | |
CN113051178A (en) | Test data construction method, device, equipment and medium | |
CN113220586A (en) | Automatic interface pressure test execution method, device and system | |
CN113760707A (en) | Interface testing method, device, equipment and computer readable storage medium | |
CN108108369B (en) | Method and device for processing calling error of common interface library |
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 |