CN116150013A - Interface testing method and device, storage medium and computer equipment - Google Patents

Interface testing method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN116150013A
CN116150013A CN202310158415.0A CN202310158415A CN116150013A CN 116150013 A CN116150013 A CN 116150013A CN 202310158415 A CN202310158415 A CN 202310158415A CN 116150013 A CN116150013 A CN 116150013A
Authority
CN
China
Prior art keywords
tested
interface
parameter
target
testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310158415.0A
Other languages
Chinese (zh)
Inventor
何辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pingan Payment Technology Service Co Ltd
Original Assignee
Pingan Payment Technology Service Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pingan Payment Technology Service Co Ltd filed Critical Pingan Payment Technology Service Co Ltd
Priority to CN202310158415.0A priority Critical patent/CN116150013A/en
Publication of CN116150013A publication Critical patent/CN116150013A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses an interface testing method and device, a storage medium and computer equipment, relates to the technical field of computers, and can solve the technical problem that a plurality of interfaces required by one function cannot be connected into one flow for testing. Comprising the following steps: receiving an interface test instruction of a target test task, and acquiring an interface set to be tested corresponding to the target test task; determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested; identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interfaces to be tested by using the parameter value until all the interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.

Description

Interface testing method and device, storage medium and computer equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an interface testing method and apparatus, a storage medium, and a computer device.
Background
Interface testing is a test that tests interfaces between components of a system. The method is mainly used for detecting interaction interfaces between systems and between subsystems in the systems, and testing is mainly used for checking exchange, transmission, control and management processes of data, mutual logic dependency relationship among the systems and the like.
Interface testing is currently performed using an interface testing tool such as postman, but postman can only test a single interface, and cannot connect a plurality of interfaces required for one function into one flow for testing.
Disclosure of Invention
In view of this, the present invention provides an interface testing method and apparatus, a storage medium, and a computer device, which can solve the technical problem that a plurality of interfaces required by a function cannot be connected into a single flow for testing.
According to a first aspect of the present invention, there is provided an interface testing method, the method comprising:
receiving an interface test instruction of a target test task, and acquiring an interface set to be tested corresponding to the target test task;
determining a target interface to be tested which is tested finally in the interface set to be tested, and parameter fields required by testing the target interface to be tested;
and identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
Preferably, if the parameter value source includes the interface return;
the step of obtaining the parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value includes:
determining the parameter field returned by the interface as a first parameter field, acquiring a preset interface to be tested with a reference relation with the first parameter field, testing the preset interface to be tested to obtain a target return value, and taking the target return value as a parameter value corresponding to the first parameter field, wherein the preset interface to be tested belongs to the interface set to be tested;
and testing the target interface to be tested by using the target return value.
Preferably, if the source of parameter values further comprises a pre-configuration;
the step of obtaining the parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value, further comprises:
determining the parameter field with the source of the parameter value as the preset parameter field as a second parameter field, determining a preset value corresponding to the second parameter field, and taking the preset value as the parameter value corresponding to the second parameter field;
and testing the target interface to be tested by using the target return value and the preset value.
Preferably, the obtaining the preset interface to be tested having the reference relation with the first parameter field, and testing the preset interface to be tested to obtain the target return value includes:
if at least two first parameter fields exist in the parameter fields, judging whether a reference sequence exists in a preset interface to be tested corresponding to the first parameter fields;
if yes, sequentially referencing the preset interfaces to be tested according to the referencing sequence, and respectively obtaining the corresponding target return values.
Preferably, after the determining whether the reference sequence exists in the preset interface to be tested corresponding to the first parameter field, the method further includes:
if not, the preset interfaces to be tested are referenced in parallel, and the corresponding target return values are respectively obtained.
Preferably, the method further comprises:
if the return values of all the interfaces to be tested are the same as the corresponding expected return values, the target test task passes;
if the return value of the interface to be tested is different from the corresponding expected return value, the target test task does not pass.
According to a second aspect of the present invention, there is provided an interface testing apparatus, the apparatus comprising:
the receiving module is used for receiving interface test instructions of a target test task and obtaining an interface set to be tested corresponding to the target test task;
the determining module is used for determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested;
the testing module is used for identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
Preferably, the apparatus further comprises:
and the judging module is used for judging that the target test task passes if the return values of all the interfaces to be tested are the same as the corresponding expected return values, and judging that the target test task does not pass if the return values of the interfaces to be tested are different from the corresponding expected return values.
According to a third aspect of the present invention, there is provided a storage medium having stored thereon a computer program which when executed by a processor implements the above-described interface test method.
According to a fourth aspect of the present invention there is provided a computer device comprising a storage medium, a processor and a computer program stored on the storage medium and executable on the processor, the processor implementing the above interface test method when executing the program.
By means of the technical scheme, the interface testing method and device, the storage medium and the computer equipment provided by the invention are characterized in that firstly, interface testing instructions of a target testing task are received, and an interface set to be tested corresponding to the target testing task is obtained; then, determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested; and finally, identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
According to the technical scheme, the parameter values corresponding to the parameter fields are obtained according to the parameter value sources, so that all interfaces to be tested in one target test task are connected for testing, so that a developer can automatically execute all processes for testing each interface only by inputting instructions for testing the target test task, existing test tools such as postman can only test a single interface, if a plurality of interfaces to be tested in one target test task are required to be tested, only one interface can be tested manually, and after the interface testing is finished, the next interface is tested manually, so that the working efficiency is greatly reduced.
The foregoing description is only an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the same may be more clearly understood and to make the same and other objects, features and advantages of the present invention more readily apparent.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute an undue limitation to the present application. In the drawings:
fig. 1 is a schematic flow chart of an interface testing method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another method for testing an interface according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an interface testing device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another interface testing device according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the drawings in conjunction with embodiments. It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
It should be noted that the principle of interface test: and simulating a process that the client sends a request message to the server, the server processes the corresponding message after receiving the request message and returns a response to the client, and the client receives the response.
Aiming at the technical problem that a plurality of interfaces required by one function cannot be connected into one flow for testing, the embodiment provides an interface testing method, as shown in fig. 1, which comprises the following steps:
101. and receiving an interface test instruction of the target test task, and acquiring an interface set to be tested corresponding to the target test task.
102. And determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested.
It should be noted that, a plurality of interfaces that need to be tested correspondingly for completing each test task are preset and stored, for example, the plurality of interfaces that need to be tested correspondingly for the test task 1 are the interfaces 11, 12, 13 and 14, where the interfaces 11, 12, 13 and 14 form the interface set 1 to be tested. Information required for testing each interface (the information required for each interface can be obtained from an interface document, also called an API document, which is generally written by a developer and is used for describing interface information provided by a system) is also preset and stored, and the method comprises the following steps: parameter field, request mode (such as get, post, etc.), and URL address, wherein the parameter field refers to parameter field name, for example: the identification card number is a parameter field, and the specific value corresponding to the identification card number is the parameter value corresponding to the parameter field of the identification card number.
In a specific application scenario, the execution subject for performing the interface test may be an interaction page in a piece of software, a tester inputs a target test task or searches for and selects the target test task from a plurality of test tasks, and then clicks to determine, and the interaction page receives an interface test instruction of the target test task.
After receiving the target test task to be tested:
firstly, acquiring an interface set to be tested (for example, interface set 1 to be tested) corresponding to a target test task (for example, test task 1), wherein the interface set to be tested comprises a plurality of interfaces to be tested (for example, interfaces 11, 12, 13 and 14), then determining a target interface to be tested (for example, interface 14) which is tested last in the interface set to be tested, and finally determining parameter fields required for testing the target interface to be tested (for example, the parameter fields required for testing the interface 14 are a, b, c, d), wherein the final test means that: and in all the interfaces to be tested, the return value obtained by testing the target interface to be tested is not the parameter value required by testing other interfaces to be tested.
The relationships between these interfaces to be tested are: can be connected into a flow to complete the target test task. In order to connect the interfaces to be tested into a process to complete the objective test task, the connection points of the interfaces to be tested are preset and stored, so that the interfaces to be tested are connected through the connection points of the interfaces to be tested during the test (for example, the parameter value corresponding to a certain parameter field in the interface 14 is the return value of the interface 11, and then the connection point is the parameter field and the interface 11).
Specifically, taking a target test task as an example, a preset and stored process is explained:
the first step: the last tested target interface to be tested (such as interface 14) in the target test task is determined, the interface document is queried for the parameter fields (such as a, b, c, d), the request mode (such as post) and the URL address (such as http:// localhost: 8888/travelbiz/train/queryicketdetail 14) required by the test interface 14, and then the parameters are saved.
And a second step of: whether the parameter value corresponding to the parameter field a, b, c, d is obtained from other interfaces or needs to be preset is manually judged, for example, the parameter value corresponding to the parameter field a is a return value obtained by testing the interface 11, the parameter value corresponding to the parameter field a and the interfaces 11 and the parameter field b is a return value obtained by testing the interface 12, the parameter value corresponding to the parameter field b and the interfaces 12 and the parameter field c is a return value obtained by testing the interface 13, the parameter value corresponding to the parameter field c and the interfaces 13 and the parameter field d is preset, the value conforming to the specification of the parameter field d is input as the parameter value corresponding to the parameter field d, and then the parameter value is stored.
And a third step of: the parameter fields (e.g. e, f), the request mode (e.g. post) and the URL address (e.g. http:// localhost: 8888/travelbiz/train/querytickettDetail 11) needed by the test interface 11 are queried from the interface document, and then saved, and it is manually determined whether the parameter values corresponding to the parameter fields e, f are obtained by other interfaces or need to be preset. For example, the parameter value corresponding to the parameter field d is a return value obtained by testing the interface 14, the connection point is that the parameter field d is preset with the interface 14, and the parameter value corresponding to the parameter field f is input as the parameter value corresponding to the parameter field f, and then stored. The interfaces 12, 13 and 14 are set and stored in the same way as in the third step.
103. Identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interfaces to be tested by using the parameter value until all the interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
For the embodiment, the step 101 and 102 of adapting the embodiment is to determine how the parameter value corresponding to the parameter field is obtained by identifying the source of the parameter value corresponding to the parameter field, and the connection points of the interfaces to be tested have been preset and stored, that is, if the source of the parameter value corresponding to a certain parameter field is the interface return, the interface to be tested corresponding to the parameter field can be found through the connection point, and the interface to be tested is tested to obtain the return value, that is, the parameter value corresponding to the parameter field.
In summary, the invention provides an interface testing method and device, a storage medium and a computer device, which firstly receive an interface testing instruction of a target testing task and acquire an interface set to be tested corresponding to the target testing task; then, determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested; and finally, identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
According to the technical scheme, the parameter values corresponding to the parameter fields are obtained according to the parameter value sources, so that all interfaces to be tested in one target test task are connected for testing, so that a developer can automatically execute all processes for testing each interface only by inputting instructions for testing the target test task, existing test tools such as postman can only test a single interface, if a plurality of interfaces to be tested in one target test task are required to be tested, only one interface can be tested manually, and after the interface testing is finished, the next interface is tested manually, so that the working efficiency is greatly reduced.
Further, as a refinement and extension of the foregoing embodiment, in order to fully describe the implementation procedure in this embodiment, another interface testing method is provided, as shown in fig. 2, where the method includes:
201. and receiving an interface test instruction of the target test task, and acquiring an interface set to be tested corresponding to the target test task.
202. And determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested.
For example steps 201 and 202, the specific implementation is the same as example steps 101 and 102, and will not be repeated here.
203. And identifying the source of the parameter value corresponding to the parameter field.
For the present embodiment, as an implementation manner, a parameter value source identifier corresponding to each parameter field is preset, so as to identify a parameter value source corresponding to the parameter field.
204. If the parameter value source comprises interface return, determining a parameter field of which the parameter value source is the interface return as a first parameter field, acquiring a preset interface to be tested which has a reference relation with the first parameter field, testing the preset interface to be tested, obtaining a target return value, taking the target return value as the parameter value corresponding to the first parameter field, and testing the target interface to be tested by using the target return value.
205. If the parameter value source further comprises pre-configuration, determining a parameter field with the parameter value source being pre-configured as a second parameter field, determining a preset value corresponding to the second parameter field, taking the preset value as the parameter value corresponding to the second parameter field, and testing the target interface to be tested by using the target return value and the preset value.
The preset interfaces to be tested belong to an interface set to be tested. It should be noted that, the preset interface to be tested having a reference relationship with the first parameter field refers to: the parameter value corresponding to the first parameter field is a target return value obtained by testing the preset interface to be tested, namely, the parameter value is related to steps 101-103 in the corresponding embodiment: the first parameter field has a connection point with a preset interface to be tested.
For the example steps 204 and 205, as an implementation manner, obtaining a preset interface to be tested having a reference relation with the first parameter field, testing the preset interface to be tested, and obtaining the target return value includes: if at least two first parameter fields exist in the parameter fields, judging whether a reference sequence exists in a preset interface to be tested corresponding to the first parameter fields; if yes, sequentially referencing a preset interface to be tested according to the referencing sequence, and respectively obtaining the corresponding target return values; if not, the interfaces to be tested are referenced in parallel, and corresponding target return values are obtained respectively.
Specifically, the interface to be tested of the test target needs a plurality of parameter fields, and in the parameter fields, all the corresponding parameter value sources may be interface returns, and part of the corresponding parameter value sources may be interface returns. For example: the parameter field required by the target interface 14 to be tested is a, b, c, d, the parameter value corresponding to the parameter field a is the target return value obtained by the test interface 11, the parameter value corresponding to the parameter field b is the target return value obtained by the test interface 12, the parameter value corresponding to the parameter field c is the target return value obtained by the test interface 13, and the parameter value corresponding to the parameter field d is preset, namely preconfigured, wherein the first parameter field is a, b and c, the second parameter field is d, and the preset interfaces to be tested are the interfaces 11, 12 and 13.
The function of determining whether there is a reference order between the interfaces 11, 12, 13 is to: if a resource needs to be referenced by at least two of the three preset interfaces to be tested, and the resource cannot be referenced simultaneously, the reference sequence of the preset interfaces to be tested can be preset manually. If the reference order is not set, the test speed can be increased by adopting the parallel reference (i.e., simultaneously referencing the interface 11, the interface 12, and the interface 13).
It should be noted that, since the target task to be tested includes a plurality of interfaces connected into a process, the parameter sources corresponding to the parameter fields required for testing the target test interface include at least an interface return, and for other interfaces to be tested in the target task except for the target test interface, the parameter value sources corresponding to the parameter fields required for calling the other interfaces to be tested include an interface return and/or a pre-configuration.
206. And until all interfaces to be tested in the interface set to be tested are completely tested.
207. If the return values of all the interfaces to be tested are the same as the corresponding expected return values, the target test task passes, and if the return values of the interfaces to be tested are different from the corresponding expected return values, the target test task does not pass.
For the embodiment, since the relationship between the interfaces to be tested in the target test task can be connected into a process, when there is a failure of the interface to be tested to pass the test, the return value obtained by the interface to be tested of the test target is necessarily different from the corresponding expected return value, further, the interface to be tested which fails the test can be located, and the reason of failing can be judged according to the returned status code, wherein the reason of failing is judged according to the returned status code belongs to the prior art, and is not described herein.
In summary, the invention provides an interface testing method and device, a storage medium and a computer device, which firstly receive an interface testing instruction of a target testing task and acquire an interface set to be tested corresponding to the target testing task; then, determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested; and finally, identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
According to the technical scheme, the parameter values corresponding to the parameter fields are obtained according to the parameter value sources, so that all interfaces to be tested in one target test task are connected for testing, so that a developer can automatically execute all processes for testing each interface only by inputting instructions for testing the target test task, existing test tools such as postman can only test a single interface, if a plurality of interfaces to be tested in one target test task are required to be tested, only one interface can be tested manually, and after the interface testing is finished, the next interface is tested manually, so that the working efficiency is greatly reduced.
Further, as a specific implementation of the method shown in fig. 1 to fig. 2, an embodiment of the present invention provides an interface testing device, as shown in fig. 3, including: a receiving module 31, a determining module 32, and a testing module 33;
the receiving module 31 is configured to receive an interface test instruction of a target test task, and obtain a to-be-tested interface set corresponding to the target test task;
a determining module 32, configured to determine a target interface to be tested that is tested last in the set of interfaces to be tested, and a parameter field required for testing the target interface to be tested;
and a testing module 33, configured to identify a source of a parameter value corresponding to the parameter field, obtain a parameter value corresponding to the parameter field according to the source of the parameter value, and test the target interface to be tested by using the parameter value until all the interfaces to be tested in the set of interfaces to be tested are tested, where the source of the parameter value at least includes an interface return.
Accordingly, the parameter value source includes the interface return, and in order to obtain the parameter value corresponding to the parameter field according to the parameter value source, the testing module 33 may specifically include: an acquisition unit 331, a test unit 332; the obtaining unit 331 is configured to determine the parameter field from which the parameter value is derived and is returned by the interface as a first parameter field, obtain a preset interface to be tested having a reference relationship with the first parameter field, test the preset interface to be tested, obtain a target return value, and use the target return value as a parameter value corresponding to the first parameter field, where the preset interface to be tested belongs to the interface set to be tested; and a test unit 332, configured to test the target interface to be tested by using the target return value.
Correspondingly, the parameter value source further includes a pre-configuration, and the obtaining unit 331 may be further configured to determine the parameter field of the parameter value source that is the pre-configuration as a second parameter field, determine a preset value corresponding to the second parameter field, and use the preset value as a parameter value corresponding to the second parameter field; the test unit 332 may be further configured to test the target interface to be tested by using the target return value and the preset value.
In order to obtain a preset interface to be tested having a reference relationship with the first parameter fields, the preset interface to be tested is tested to obtain a target return value, and the obtaining unit 331 may be specifically configured to determine whether a reference sequence exists in the preset interface to be tested corresponding to the first parameter fields if at least two first parameter fields exist in the parameter fields; if yes, sequentially referencing the preset interfaces to be tested according to the referencing sequence, and respectively obtaining the corresponding target return values; if not, the preset interfaces to be tested are referenced in parallel, and the corresponding target return values are respectively obtained.
In a specific application scenario, an interface testing apparatus, as shown in fig. 4, the apparatus further includes: the judging module 34 is specifically configured to pass the target test task if the return values of all the interfaces to be tested are the same as the corresponding expected return values; if the return value of the interface to be tested is different from the corresponding expected return value, the target test task does not pass.
It should be noted that, other corresponding descriptions of each functional unit related to the interface testing apparatus provided in this embodiment may refer to corresponding descriptions of fig. 1 to 2, and are not described herein again.
Based on the above-mentioned method shown in fig. 1 to 2, correspondingly, the present embodiment further provides a storage medium, which may be specifically volatile or nonvolatile, and has a computer program stored thereon, where the program is executed by a processor to implement the above-mentioned interface testing method shown in fig. 1 to 2.
Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which may be stored in a storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.), and includes several instructions for causing a computer device (may be a personal computer, a server, or a network device, etc.) to execute the method of each implementation scenario of the present invention.
Based on the above-described method shown in fig. 1 to 2 and the virtual device embodiments shown in fig. 3 to 4, in order to achieve the above-described object, the present embodiment further provides a computer apparatus, which includes a storage medium and a processor; a storage medium storing a computer program; a processor for executing a computer program to implement the interface test method as described above and shown in fig. 1 to 2.
Optionally, the computer device may also include a user interface, a network interface, a camera, radio Frequency (RF) circuitry, sensors, audio circuitry, WI-FI modules, and the like. The user interface may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
It will be appreciated by those skilled in the art that the architecture of a computer device provided in this embodiment is not limited to this physical device, but may include more or fewer components, or may be combined with certain components, or may be arranged in a different arrangement of components.
The storage medium may also include an operating system, a network communication module. An operating system is a program that manages the computer device hardware and software resources described above, supporting the execution of information handling programs and other software and/or programs. The network communication module is used for realizing communication among all components in the storage medium and communication with other hardware and software in the information processing entity equipment.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present invention may be implemented by means of software plus necessary general hardware platforms, or may be implemented by hardware.
The invention provides an interface test method and device, a storage medium and computer equipment, wherein the interface test method and device comprises the steps of firstly receiving an interface test instruction of a target test task and obtaining an interface set to be tested corresponding to the target test task; then, determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested; and finally, identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
According to the technical scheme, the parameter values corresponding to the parameter fields are obtained according to the parameter value sources, so that all interfaces to be tested in one target test task are connected for testing, so that a developer can automatically execute all processes for testing each interface only by inputting instructions for testing the target test task, existing test tools such as postman can only test a single interface, if a plurality of interfaces to be tested in one target test task are required to be tested, only one interface can be tested manually, and after the interface testing is finished, the next interface is tested manually, so that the working efficiency is greatly reduced.
Those skilled in the art will appreciate that the drawing is merely a schematic illustration of a preferred implementation scenario and that the modules or flows in the drawing are not necessarily required to practice the invention. Those skilled in the art will appreciate that modules in an apparatus in an implementation scenario may be distributed in an apparatus in an implementation scenario according to an implementation scenario description, or that corresponding changes may be located in one or more apparatuses different from the implementation scenario. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above-mentioned inventive sequence numbers are merely for description and do not represent advantages or disadvantages of the implementation scenario. The foregoing disclosure is merely illustrative of some embodiments of the invention, and the invention is not limited thereto, as modifications may be made by those skilled in the art without departing from the scope of the invention.

Claims (10)

1. An interface testing method, the method comprising:
receiving an interface test instruction of a target test task, and acquiring an interface set to be tested corresponding to the target test task;
determining a target interface to be tested which is tested finally in the interface set to be tested, and parameter fields required by testing the target interface to be tested;
and identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
2. The method of claim 1, wherein if the parameter value source comprises the interface return;
the step of obtaining the parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value includes:
determining the parameter field returned by the interface as a first parameter field, acquiring a preset interface to be tested with a reference relation with the first parameter field, testing the preset interface to be tested to obtain a target return value, and taking the target return value as a parameter value corresponding to the first parameter field, wherein the preset interface to be tested belongs to the interface set to be tested;
and testing the target interface to be tested by using the target return value.
3. The method of claim 2, wherein if the source of parameter values further comprises a pre-configuration;
the step of obtaining the parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value, further comprises:
determining the parameter field with the source of the parameter value as the preset parameter field as a second parameter field, determining a preset value corresponding to the second parameter field, and taking the preset value as the parameter value corresponding to the second parameter field;
and testing the target interface to be tested by using the target return value and the preset value.
4. A method according to claim 2 or 3, wherein the obtaining a preset interface to be tested having a reference relation with the first parameter field, testing the preset interface to be tested, and obtaining a target return value, includes:
if at least two first parameter fields exist in the parameter fields, judging whether a reference sequence exists in a preset interface to be tested corresponding to the first parameter fields;
if yes, sequentially referencing the preset interfaces to be tested according to the referencing sequence, and respectively obtaining the corresponding target return values.
5. The method of claim 4, further comprising, after the determining whether the reference order exists for the preset interface to be tested corresponding to the first parameter field:
if not, the preset interfaces to be tested are referenced in parallel, and the corresponding target return values are respectively obtained.
6. The method as recited in claim 1, further comprising:
if the return values of all the interfaces to be tested are the same as the corresponding expected return values, the target test task passes;
if the return value of the interface to be tested is different from the corresponding expected return value, the target test task does not pass.
7. An interface testing apparatus, the apparatus comprising:
the receiving module is used for receiving interface test instructions of a target test task and obtaining an interface set to be tested corresponding to the target test task;
the determining module is used for determining a target interface to be tested which is tested finally in the interface set to be tested and parameter fields required by testing the target interface to be tested;
the testing module is used for identifying a parameter value source corresponding to the parameter field, acquiring a parameter value corresponding to the parameter field according to the parameter value source, and testing the target interface to be tested by using the parameter value until all interfaces to be tested in the interface set to be tested are tested, wherein the parameter value source at least comprises interface return.
8. The apparatus of claim 7, wherein the apparatus further comprises:
and the judging module is used for judging that the target test task passes if the return values of all the interfaces to be tested are the same as the corresponding expected return values, and judging that the target test task does not pass if the return values of the interfaces to be tested are different from the corresponding expected return values.
9. A storage medium having stored thereon a computer program, wherein the program when executed by a processor implements the interface testing method of any of claims 1 to 6.
10. A computer device comprising a memory, a processor and a computer program stored on the storage medium and executable on the processor, characterized in that the processor implements the interface testing method of any of claims 1 to 6 when executing the program.
CN202310158415.0A 2023-02-16 2023-02-16 Interface testing method and device, storage medium and computer equipment Pending CN116150013A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310158415.0A CN116150013A (en) 2023-02-16 2023-02-16 Interface testing method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310158415.0A CN116150013A (en) 2023-02-16 2023-02-16 Interface testing method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN116150013A true CN116150013A (en) 2023-05-23

Family

ID=86350493

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310158415.0A Pending CN116150013A (en) 2023-02-16 2023-02-16 Interface testing method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN116150013A (en)

Similar Documents

Publication Publication Date Title
US9465724B2 (en) Method, program, and system for generating test cases
CN106970880B (en) Distributed automatic software testing method and system
CN105787364B (en) Automatic testing method, device and system for tasks
CN110058998B (en) Software testing method and device
CN109408309B (en) Multi-terminal testing method and device
CN112052169A (en) Test management method, system, device and computer readable storage medium
CN107621963B (en) Software deployment method, software deployment system and electronic equipment
CN112148607A (en) Interface testing method and device for service scene
CN107229565B (en) Test method and device
CN110187890B (en) Project deployment method, electronic equipment and storage medium
CN112433935A (en) Test method, test device, electronic equipment and storage medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN111930621A (en) DNS automation performance testing method, device, equipment and readable storage medium
KR101794016B1 (en) Method of analyzing application objects based on distributed computing, method of providing item executable by computer, server performing the same and storage media storing the same
CN109120433B (en) Method and apparatus for containerized deployment of hosts
CN110609786A (en) Software testing method and device, computer equipment and storage medium
CN116150013A (en) Interface testing method and device, storage medium and computer equipment
CN105162799A (en) Method for checking whether client is legal mobile terminal or not and server
CN110704301B (en) TPC-E automatic test method and TPC-E test system
CN113704114A (en) Automatic testing method, device, equipment and medium for functional interface
CN113986747A (en) Data generation method and device, electronic equipment and storage medium
CN111294250B (en) Pressure testing method, device and system
CN111225075A (en) Configuration method and device for Internet of things directional access service
CN113031995A (en) Rule updating method and device, storage medium and electronic equipment
CN112631931A (en) Version testing method and device, storage medium and electronic equipment

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