CN116881116A - Interface test method, apparatus, computer device, storage medium, and program product - Google Patents
Interface test method, apparatus, computer device, storage medium, and program product Download PDFInfo
- Publication number
- CN116881116A CN116881116A CN202310647059.9A CN202310647059A CN116881116A CN 116881116 A CN116881116 A CN 116881116A CN 202310647059 A CN202310647059 A CN 202310647059A CN 116881116 A CN116881116 A CN 116881116A
- Authority
- CN
- China
- Prior art keywords
- data set
- interface
- field
- tested
- equivalence class
- 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 abstract description 4
- 238000012360 testing method Methods 0.000 claims abstract description 188
- 238000000034 method Methods 0.000 claims abstract description 25
- 238000004590 computer program Methods 0.000 claims description 37
- 230000002159 abnormal effect Effects 0.000 claims description 22
- 238000012545 processing Methods 0.000 claims description 10
- 238000010586 diagram Methods 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000007667 floating Methods 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 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
- 238000011056 performance test Methods 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
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/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
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 present application relates to an interface test method, apparatus, computer device, storage medium, and program product. The method comprises the following steps: acquiring field information of each field corresponding to the interface to be tested; acquiring an initial data set corresponding to each field; dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field; and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested. By adopting the method, the test efficiency of the interface test can be improved.
Description
Technical Field
The present application relates to the field of interface testing technologies, and in particular, to an interface testing method, an apparatus, a computer device, a storage medium, and a program product.
Background
Interface testing is a test for testing interfaces between components of a system, and is mainly used for detecting interaction points between an external system and an internal system and between all subsystems in the internal system. The key point of the test is to check the exchange of data, the transfer and control management process, and the mutual logic dependency between systems.
In the traditional technology, a tester firstly determines the value of each field corresponding to the interface, then manually creates a script file corresponding to the interface according to the value of each field, and finally executes the script file to test the interface, so that the efficiency of interface test is lower.
Disclosure of Invention
In view of the foregoing, it is desirable to provide an interface testing method, apparatus, computer device, storage medium, and program product that can improve the testing efficiency of interface testing.
In a first aspect, the present application provides an interface testing method. The method comprises the following steps:
acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In one embodiment, the equivalence class dataset includes at least one of a first equivalence class dataset, a second equivalence class dataset, and a boundary equivalence class dataset;
The first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In one embodiment, the testing the interface to be tested according to the equivalence class data set corresponding to each field and the interface test script template of the interface to be tested includes:
combining the first data element with any one of the second data elements in each of the second equivalent class data sets for each of the first data elements in each of the first equivalent class data sets in the equivalent class data set corresponding to each of the fields to obtain a plurality of initial data sets corresponding to the interface to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
and testing the interface to be tested based on each initial data set and the interface test script template.
In one embodiment, the testing the interface to be tested based on each of the initial data set and the interface test script template includes:
determining each target data set based on each of the initial data sets;
filling the target data sets into preset positions in the interface test script template aiming at each target data set to obtain an interface test script file;
and executing the interface test script file to test the interface to be tested.
In one embodiment, the determining each target data set based on each of the initial data sets includes:
and if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
In one embodiment, the obtaining field information of each field corresponding to the interface to be tested includes:
acquiring an interface test instruction; the interface test instruction comprises an interface identifier of the interface to be tested;
and acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
In one embodiment, the obtaining, according to the interface identifier, field information of each field corresponding to the interface to be tested includes:
Generating a field information acquisition instruction according to the interface identifier;
transmitting the field information acquisition instruction to the management equipment;
and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
In a second aspect, the application further provides an interface testing device. The device comprises:
the first acquisition module is used for acquiring field information of each field corresponding to the interface to be tested;
the second acquisition module is used for acquiring an initial data set corresponding to each field;
the dividing module is used for dividing the initial data set corresponding to each field according to a preset equivalence class dividing rule to obtain an equivalence class data set corresponding to each field;
and the test module is used for testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring field information of each field corresponding to the interface to be tested;
Acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, performs the steps of:
Acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
According to the interface testing method, the device, the computer equipment, the storage medium and the program product, the initial data set corresponding to each field is obtained by obtaining the field information of each field corresponding to the interface to be tested, the initial data set corresponding to each field is divided according to the preset equivalence class division rule to obtain the equivalence class data set corresponding to each field, and then the interface to be tested is tested according to the equivalence class data set corresponding to each field and the interface testing script template of the interface to be tested. In the traditional technology, a tester determines the value of each field corresponding to the interface to be tested, then manually creates a script file corresponding to the interface according to the value of each field, and finally executes the script file to test the interface to be tested, so that the efficiency of interface test is lower. In the application, the equivalent class data set of each field corresponding to the interface to be tested is determined by the computer equipment, and then the interface to be tested is tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested, so that the test efficiency of the interface test is improved.
Drawings
FIG. 1 is an internal block diagram of a computer device provided by an embodiment of the present application;
FIG. 2 is a flow chart of an interface testing method according to an embodiment of the present application;
FIG. 3 is a second flow chart of an interface testing method according to the embodiment of the application;
FIG. 4 is a third flow chart of an interface testing method according to an embodiment of the application;
fig. 5 is a schematic flow chart of a field information obtaining method according to an embodiment of the present application;
FIG. 6 is a second flowchart of a field information acquiring method according to an embodiment of the present application;
fig. 7 is a block diagram of an interface testing apparatus according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The embodiment provided by the application can be applied to the computer equipment shown in fig. 1, and referring to fig. 1, fig. 1 is an internal structure diagram of the computer equipment provided in the embodiment of the application. The computer device may be a terminal. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a resource scaling method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the architecture shown in fig. 1 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements may be implemented, as a particular computer device may include more or less components than those shown, or may be combined with some components, or may have a different arrangement of components.
In one embodiment, as shown in fig. 2, an interface testing method is provided, and the method is applied to the computer device in fig. 1 for illustration, and includes the following steps:
s201, acquiring field information of each field corresponding to the interface to be tested.
The field information comprises field identification of the field, field type and description information of the field, wherein the field type can be date, character string, integer, floating point number, boolean value and the like. The description information of the field may include a range of values of the field.
In this embodiment, field information of each field corresponding to the interface to be tested may be stored in the first storage space, and field information of each field corresponding to the interface to be tested may be obtained from the first storage space according to the interface identifier of the interface to be tested. The first storage space may be a storage space on a corresponding memory in the computer device, or the first storage space may also be a cloud storage space created in the cloud.
S202, acquiring an initial data set corresponding to each field.
The initial data set corresponding to each field comprises a value set corresponding to each field.
In this embodiment, the initial data set corresponding to each field type is stored in the second storage space, and the initial data set corresponding to each digital segment type may be obtained from the second storage space according to the field type corresponding to each field. The second storage space may be a storage space on a memory corresponding to the computer device, or the second storage space may also be a cloud storage space created in the cloud.
S203, dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field.
The preset equivalence class classification rule may include a rule of classifying the equivalence class data sets according to a data range of data elements in the initial data set, for example, if a field type is an integer from 1 to 9, the initial data set corresponding to the integer field includes {0,1,2,3,4,5,6,7,8,9, 10}, a set corresponding to data elements less than or equal to 5 may be classified into an equivalence class data set a according to the range of data elements in the data set, a set corresponding to data elements greater than 5 may be classified into an equivalence class data set B, and a= {0,1,2,3,4, 5}, b= {6,7,8,9, 10}.
Optionally, the preset equivalence class classification rule may also include a rule for classifying the equivalence class data set according to valid data elements and invalid data elements in the initial data set, for example, classifying normal data elements in the initial data set into an equivalence class data set C, and classifying abnormal data elements in the initial data set into an equivalence class data set D; then c= {0, 10}, d= {1,2,3,4,5,6,7,8,9}. Alternatively, the preset equivalence class classification rules may also include rules for classifying the equivalence class dataset according to boundary values and non-boundary values in the initial dataset. For example, the boundary value data elements in the initial data set are divided into an equivalence class data set E, and the non-boundary value data elements in the initial data set are divided into an equivalence class data set F, then e= {1,9}, f= {1,2,3,4,5,6,7,8, 10}.
S204, testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In this embodiment, the interface test script templates of the interfaces are stored in the third storage space, and each interface test script template corresponds to an interface identifier of the interface, so that the interface test script template of the interface to be tested can be determined from the third storage space according to the interface identifier of the interface to be tested. The third storage space is a storage space in a memory corresponding to the computer device, or the third storage space may be a cloud storage space created by the cloud. Specifically, after an interface test script template of an interface to be tested is obtained, filling data elements in an equivalent class data set corresponding to each field into a preset position in the interface test script template to obtain an interface test script file, executing the interface test script file, and completing the test of the interface to be tested. The interface test script templates may include script templates created based on a performance test (Jmeter) script.
In the interface testing method, field information of each field corresponding to the interface to be tested is obtained, an initial data set corresponding to each field is obtained, and the initial data set corresponding to each field is divided according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field; and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested. In the traditional technology, a tester determines the value of each field corresponding to the interface, then manually creates a script file corresponding to the interface according to the value of each field, and finally executes the script file to test the interface, so that the efficiency of interface test is lower. In the application, the equivalent class data set of each field corresponding to the interface to be tested is determined by the computer equipment, and then the interface to be tested is tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested, so that the test efficiency of the interface test is improved.
In one embodiment, the equivalence class data set includes at least one of a first equivalence class data set, a second equivalence class data set, and a boundary equivalence class data set.
The first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In this embodiment, the initial data set corresponding to each field may be divided according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field; the equivalence class data set comprises at least one of a first equivalence class data set, a second equivalence class data set and a boundary equivalence class data set, wherein the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set. In connection with the above example, if the field type of the field M is an integer from 1 to 9, and the initial data set corresponding to the integer field includes {0,1,2,3,4,5,6,7,8,9, 10}, the first equivalence class data set is {0, 10}, the second equivalence class data set is {1,2, 3,4,5,6,7,8,9}, and the boundary value equivalence class data set is {1,9}.
The equivalence class data set is divided into a first equivalence class data set, a second equivalence class data set and a boundary equivalence class data set, so that the interface to be tested is tested according to the equivalence class data set and the interface test script template of the interface to be tested, and the comprehensiveness of the interface test is improved.
Fig. 3 is a second flow chart of an interface testing method according to the embodiment of the present application, which relates to a possible implementation manner of testing an interface to be tested according to an equivalence class data set corresponding to each field and an interface testing script template of the interface to be tested, as shown in fig. 3, the step S204 may include the following steps:
s301, combining the first data element with any one of the second data elements in each second equivalence class data set aiming at each first data element in each first equivalence class data set in the equivalence class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interface to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field.
In this embodiment, for each first data element in a first equivalent class data set in an equivalent class data set corresponding to each field, the first data element is combined with any one of second data elements in each second equivalent class data set to obtain a plurality of initial data sets corresponding to interfaces to be tested; for example, the interface to be tested includes two fields, namely AN integer field M and a date field N within 1 to 9, respectively, a normal equivalence class dataset am= {2, 3}, AN abnormal equivalence class dataset bm= {0, 10}, a boundary value equivalence class dataset cm= {1,9}, a normal equivalence class dataset an= {20230420, 20230422}, AN abnormal equivalence class dataset bn= {20230432}, a boundary value equivalence class dataset cn= {20230430}, and the initial data set is shown in table 1
TABLE 1
Optionally, the initial data set may also include field identifiers for the fields, e.g., initial data set {0, 20230420} may also be denoted as { M: "0", N: "20230420" }, where M is the field identification of the integer field M, and N is the field identification of the date field N.
S302, testing the interface to be tested based on each initial data set and the interface test script template.
In this embodiment, each data element in each initial data set may be filled into a corresponding position of each field in the interface test script template to obtain an interface test script file corresponding to each initial data set, and the interface test script file corresponding to each initial data set is executed by the target device to complete the test of the interface to be tested. The target device may include various automated test tools.
In the embodiment of the application, the first data elements and any one of the second data elements in the second equivalent class data set are combined by aiming at each first data element in the first equivalent class data set in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interface to be tested, and then the interface to be tested is tested based on each initial data set and the interface test script template, and each initial data set is obtained by combining the data elements corresponding to the fields, so that the comprehensiveness of the interface test is improved.
Fig. 4 is a third flow chart of an interface testing method according to an embodiment of the present application, which relates to a possible implementation manner of testing an interface to be tested based on each initial data set and an interface test script template, as shown in fig. 4, the step S302 may include the following steps:
S401, determining each target data group based on each initial data group.
S402, filling the target data sets into preset positions in the interface test script template aiming at each target data set to obtain an interface test script file.
S403, executing an interface test script file to test the interface to be tested.
In this embodiment, each target data set may be determined from the initial data set according to a preset data set selection rule, for example, a data set formed by data elements in a normal equivalence class data set in the initial data set may be used as the target data set. As described in connection with the above examples, the target data set includes {2, 20230420}, {2, 20230422}, {3, 20230420}, {3, 20230422}. Filling the target data set into a preset position in the interface test script template to obtain an interface test script file, and executing the interface test script file to test the interface to be tested.
Alternatively, a data group composed of data elements in the normal equivalent class data set and the abnormal equivalent class data set in the initial data group may be regarded as the target data group, or a data group composed of data elements in the normal equivalent class data set and the abnormal equivalent class data set in the initial data group may be regarded as the target data group, for example, a data group composed of data elements in the normal equivalent class data set of the field M and data elements in the abnormal equivalent class data set of the field N may be regarded as the target data group, the target data group including {2, 20230432}, {3, 20230432}.
According to the embodiment of the application, aiming at each target data set, the data elements in the target data set are filled in the preset positions in the interface test script template to obtain the interface test script file, and then the interface test script file is executed to test the interface to be tested, so that the efficiency of interface test is improved.
In one embodiment, the determining each target data set based on each initial data set in S401 may include the following steps:
and if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
In this embodiment, the data elements in each initial data set are detected, if there are initial data sets with the same data elements in each initial data set, the deduplication process is performed on the initial data sets with the same data elements, and only one data set is reserved in each initial data set with the same data elements, for example, if it is detected that the repeated initial data sets are a1= {1, 20230422}, a2= {1, 20230422}, a3= {1, 20230422}, then A2 and A3 may be deleted to obtain each target data set.
In the embodiment of the application, if the data elements in the plurality of initial data sets are the same in each initial data set, the plurality of initial data sets are subjected to the de-duplication processing to obtain each target data set, and the repeated test of the interface to be tested is avoided through the de-duplication processing, so that the test resources in the interface test process are saved.
Fig. 5 is one of the flow diagrams of the field information obtaining method provided by the embodiment of the present application, and this embodiment relates to one possible implementation manner of obtaining field information of each field corresponding to an interface to be tested, as shown in fig. 5, where the step S201 may include the following steps:
s501, acquiring an interface test instruction; the interface test instruction includes an interface identification of the interface to be tested.
S502, according to the interface identification, acquiring field information of each field corresponding to the interface to be tested.
In this embodiment, an interface test instruction may be obtained through a target device, where the interface test instruction includes an interface identifier of an interface to be tested, and field information of each field of the interface to be tested is obtained from a first storage space according to the interface identifier of the interface to be tested.
In the embodiment of the application, the interface test instruction is obtained; the interface test instruction comprises the interface identification of the interface to be tested, and further, according to the interface identification, the field information of each field corresponding to the interface to be tested is obtained, so that the efficiency of interface test is improved.
Fig. 6 is a second flowchart of a field information obtaining method according to the embodiment of the present application, which relates to a possible implementation manner of obtaining field information of each field corresponding to an interface to be tested according to an interface identifier, as shown in fig. 6, the step S502 may include the following steps:
S601, generating a field information acquisition instruction according to the interface identifier.
S602, sending a field information acquisition instruction to the management device.
S603, receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
The field information of each field of the interface to be tested is stored in the management device, the management device comprises an interface management system, the target device can generate a field information acquisition instruction according to the interface identifier and send the field information acquisition instruction to the management device, the field information acquisition instruction can comprise the interface identifier of the interface to be tested and the field identifier of each field of the interface to be tested, the management device determines the interface to be tested based on the interface identifier in the field information acquisition instruction, determines the field information of each field corresponding to the interface to be tested based on the field identifier in the field information acquisition instruction, and sends the field information of each field corresponding to the interface to be tested to the target device. The target device is a device for executing the interface test method of the present application, and the target device may be a computer device.
In the embodiment of the application, the field information acquisition instruction is generated according to the interface identifier, and the field information acquisition instruction is sent to the management equipment, so that the field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction, is received, and the efficiency of interface testing is improved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides an interface testing device for realizing the above related interface testing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the interface testing device provided below may be referred to the limitation of the interface testing method hereinabove, and will not be repeated here.
In one embodiment, as shown in fig. 7, there is provided an interface test apparatus 700 comprising: a first acquisition module 701, a second acquisition module 702, a partitioning module 703 and a testing module 704, wherein:
a first obtaining module 701, configured to obtain field information of each field corresponding to the interface to be tested;
a second obtaining module 702, configured to obtain an initial data set corresponding to each field;
the dividing module 703 is configured to divide the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and the test module 704 is used for testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
4. In one embodiment, the equivalence class data set includes at least one of a first equivalence class data set, a second equivalence class data set, and a boundary equivalence class data set;
the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In one embodiment, test module 704 includes:
the combining unit is used for combining the first data element with any one of the second data elements in each second equivalent class data set aiming at each first data element in each first equivalent class data set in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interface to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
the first test unit is used for testing the interface to be tested based on each initial data set and the interface test script template.
In one embodiment, the first test unit is specifically configured to determine each target data set based on each initial data set; filling the target data sets into preset positions in an interface test script template aiming at each target data set to obtain an interface test script file; and executing the interface test script file to test the interface to be tested.
In one embodiment, the first test unit is specifically configured to determine each target data set based on each initial data set; filling the target data sets into preset positions in an interface test script template aiming at each target data set to obtain an interface test script file; and executing the interface test script file to test the interface to be tested.
In one embodiment, the first acquisition module 701 includes:
the first acquisition unit is used for acquiring an interface test instruction; the interface test instruction comprises an interface identifier of an interface to be tested;
and the second acquisition unit is used for acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
In one embodiment, the second obtaining unit is specifically configured to generate a field information obtaining instruction according to the interface identifier; transmitting a field information acquisition instruction to the management equipment; and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
The respective modules in the above-described interface test apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
Acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In one embodiment, the equivalence class data set includes at least one of a first equivalence class data set, a second equivalence class data set, and a boundary equivalence class data set;
the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In one embodiment, the processor when executing the computer program further performs the steps of:
combining the first data element with any one of the second data elements in each of the second equivalent class data sets for each first data element in each of the first equivalent class data sets in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interfaces to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
And testing the interface to be tested based on each initial data set and the interface test script template.
In one embodiment, the processor when executing the computer program further performs the steps of:
determining each target data set based on each initial data set;
filling the target data sets into preset positions in an interface test script template aiming at each target data set to obtain an interface test script file;
and executing the interface test script file to test the interface to be tested.
In one embodiment, the processor when executing the computer program further performs the steps of:
and if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
In one embodiment, the processor when executing the computer program further performs the steps of:
acquiring an interface test instruction; the interface test instruction comprises an interface identifier of an interface to be tested;
and acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
In one embodiment, the processor when executing the computer program further performs the steps of:
generating a field information acquisition instruction according to the interface identifier;
Transmitting a field information acquisition instruction to the management equipment;
and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In one embodiment, the equivalence class data set includes at least one of a first equivalence class data set, a second equivalence class data set, and a boundary equivalence class data set;
the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In one embodiment, the computer program when executed by the processor further performs the steps of:
combining the first data element with any one of the second data elements in each of the second equivalent class data sets for each first data element in each of the first equivalent class data sets in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interfaces to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
and testing the interface to be tested based on each initial data set and the interface test script template.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining each target data set based on each initial data set;
filling the target data sets into preset positions in an interface test script template aiming at each target data set to obtain an interface test script file;
and executing the interface test script file to test the interface to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of:
And if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring an interface test instruction; the interface test instruction comprises an interface identifier of an interface to be tested;
and acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a field information acquisition instruction according to the interface identifier;
transmitting a field information acquisition instruction to the management equipment;
and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
And testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
In one embodiment, the equivalence class data set includes at least one of a first equivalence class data set, a second equivalence class data set, and a boundary equivalence class data set;
the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
In one embodiment, the computer program when executed by the processor further performs the steps of:
combining the first data element with any one of the second data elements in each of the second equivalent class data sets for each first data element in each of the first equivalent class data sets in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interfaces to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
And testing the interface to be tested based on each initial data set and the interface test script template.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining each target data set based on each initial data set;
filling the target data sets into preset positions in an interface test script template aiming at each target data set to obtain an interface test script file;
and executing the interface test script file to test the interface to be tested.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
In one embodiment, the computer program when executed by the processor further performs the steps of:
acquiring an interface test instruction; the interface test instruction comprises an interface identifier of an interface to be tested;
and acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of:
generating a field information acquisition instruction according to the interface identifier;
Transmitting a field information acquisition instruction to the management equipment;
and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
The user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.
Claims (11)
1. An interface testing method, the method comprising:
acquiring field information of each field corresponding to the interface to be tested;
acquiring an initial data set corresponding to each field;
dividing the initial data set corresponding to each field according to a preset equivalence class division rule to obtain an equivalence class data set corresponding to each field;
and testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
2. The method of claim 1, wherein the equivalence class dataset comprises at least one of a first equivalence class dataset, a second equivalence class dataset, and a boundary equivalence class dataset;
the first equivalence class data set is an abnormal data set in the initial data set corresponding to the field, the second equivalence class data set is a normal data set except the abnormal data set in the initial data set corresponding to the field, and the boundary equivalence class data set comprises boundary values in the second equivalence class data set.
3. The method according to claim 1, wherein the testing the interface to be tested according to the equivalence class data set corresponding to each field and the interface test script template of the interface to be tested includes:
combining the first data element with any one of the second data elements in each second equivalent class data set for each first data element in each first equivalent class data set in the equivalent class data set corresponding to each field to obtain a plurality of initial data sets corresponding to the interface to be tested; the first equivalence class data set is any data set in the equivalence class data set corresponding to each field, and each second equivalence class data set comprises data sets except the first equivalence class data set in the equivalence class data set corresponding to each field;
And testing the interface to be tested based on each initial data set and the interface test script template.
4. A method according to claim 3, wherein said testing the interface under test based on each of the initial data sets and the interface test script template comprises:
determining each target data set based on each initial data set;
filling the target data sets into preset positions in the interface test script template aiming at each target data set to obtain an interface test script file;
and executing the interface test script file to test the interface to be tested.
5. The method of claim 4, wherein said determining each target data set based on each of said initial data sets comprises:
and if the data elements in the plurality of initial data sets are the same in each initial data set, performing de-duplication processing on the plurality of initial data sets to obtain each target data set.
6. The method according to any one of claims 1-5, wherein the obtaining field information of each field corresponding to the interface to be tested includes:
acquiring an interface test instruction; the interface test instruction comprises an interface identifier of the interface to be tested;
And acquiring field information of each field corresponding to the interface to be tested according to the interface identifier.
7. The method of claim 6, wherein the obtaining, according to the interface identifier, field information of each field corresponding to the interface to be tested includes:
generating a field information acquisition instruction according to the interface identifier;
transmitting the field information acquisition instruction to management equipment;
and receiving field information of each field corresponding to the interface to be tested, which is sent by the management equipment based on the field information acquisition instruction.
8. An interface testing apparatus, the apparatus comprising:
the first acquisition module is used for acquiring field information of each field corresponding to the interface to be tested;
the second acquisition module is used for acquiring an initial data set corresponding to each field;
the dividing module is used for dividing the initial data set corresponding to each field according to a preset equivalence class dividing rule to obtain an equivalence class data set corresponding to each field;
and the test module is used for testing the interface to be tested according to the equivalent class data set corresponding to each field and the interface test script template of the interface to be tested.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
11. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310647059.9A CN116881116A (en) | 2023-06-02 | 2023-06-02 | Interface test method, apparatus, computer device, storage medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310647059.9A CN116881116A (en) | 2023-06-02 | 2023-06-02 | Interface test method, apparatus, computer device, storage medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116881116A true CN116881116A (en) | 2023-10-13 |
Family
ID=88253722
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310647059.9A Pending CN116881116A (en) | 2023-06-02 | 2023-06-02 | Interface test method, apparatus, computer device, storage medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116881116A (en) |
-
2023
- 2023-06-02 CN CN202310647059.9A patent/CN116881116A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN116932935A (en) | Address matching method, device, equipment, medium and program product | |
CN116258597A (en) | Document processing method, device, computer equipment and storage medium | |
CN116881116A (en) | Interface test method, apparatus, computer device, storage medium, and program product | |
CN117555955B (en) | Data conversion method, data conversion device, computer device, and storage medium | |
CN117435478A (en) | Program logic function detection method, device, computer equipment and storage medium | |
CN117331812A (en) | Service code verification method, device, computer equipment, storage medium and product | |
CN118132656A (en) | Knowledge graph construction method, knowledge graph construction device, computer equipment and storage medium | |
CN117609037A (en) | Non-empty verification method, device, computer equipment and storage medium | |
CN116701178A (en) | Interface test method, device, computer equipment and storage medium | |
CN118193396A (en) | Test method, test apparatus, computer device, storage medium, and program product | |
CN117349320A (en) | Data processing method, device, computer equipment and storage medium | |
CN117608958A (en) | Test report generation method, device, computer equipment and storage medium | |
CN116204541A (en) | Multidimensional database updating method, multidimensional database updating device, computer equipment and storage medium | |
CN116561010A (en) | Interface test method, device, computer equipment and storage medium | |
CN117435910A (en) | Abnormal data detection method and device and computer equipment | |
CN116049009A (en) | Test method, test device, computer equipment and computer readable storage medium | |
CN117435651A (en) | Test data processing method, device, computer equipment and storage medium | |
CN116011029A (en) | Information verification method, information verification device, computer equipment and storage medium | |
CN116910115A (en) | Group query method, device, computer equipment and storage medium | |
CN116861326A (en) | Report classification method, report classification device, computer equipment, storage medium and program product | |
CN116029026A (en) | Model file processing method, device, equipment, storage medium and program product | |
CN118409956A (en) | Performance test method, apparatus, computer device, storage medium, and program product | |
CN117574871A (en) | Report generation method, apparatus, device, medium, and program product | |
CN117612192A (en) | Electronic drawing information identification method, system, electronic equipment and storage medium | |
CN117194217A (en) | Interface testing method, device, computer equipment and 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 |