CN110795328A - Interface testing method and device - Google Patents

Interface testing method and device Download PDF

Info

Publication number
CN110795328A
CN110795328A CN201810862002.XA CN201810862002A CN110795328A CN 110795328 A CN110795328 A CN 110795328A CN 201810862002 A CN201810862002 A CN 201810862002A CN 110795328 A CN110795328 A CN 110795328A
Authority
CN
China
Prior art keywords
test
running
interface
sequence
interfaces
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
CN201810862002.XA
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810862002.XA priority Critical patent/CN110795328A/en
Publication of CN110795328A publication Critical patent/CN110795328A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING; 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

Abstract

The invention discloses an interface testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a running sequence of a plurality of configured interfaces; and executing the test cases of the plurality of interfaces according to the running sequence to generate a test result. The implementation mode can flexibly adjust the sequence of the interface test, thereby simplifying repeated codes, realizing better interface test management and achieving better test effect.

Description

Interface testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to an interface testing method and device.
Background
With the continuous development of testing technology, the application field of the interface automation testing technology is more and more extensive. Automated testing techniques have shown absolute advantages in terms of shortening the test cycle and improving the quality of the system under test. In the testing process, the simulation of the testing process through the interfaces is more and more frequent, but the operation and the sequencing among the interfaces result in more and more repeated codes.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
existing schemes result in more and more repetitive codes.
Disclosure of Invention
In view of this, embodiments of the present invention provide an interface testing method and apparatus, which can flexibly adjust an interface testing sequence, thereby simplifying repeated codes, implementing better interface testing management, and achieving better testing effect.
To achieve the above object, according to an aspect of an embodiment of the present invention, an interface testing method is provided.
An interface testing method, comprising: acquiring a running sequence of a plurality of configured interfaces; and executing the test cases of the plurality of interfaces according to the running sequence to generate a test result.
Optionally, the step of executing the test cases of the plurality of interfaces according to the running sequence to generate a test result includes: adding a plurality of interface operation codes of the test case to a pipeline according to the operation sequence; and running each interface running code of the test case by using the configured test parameter set in the pipeline to generate a test result.
Optionally, obtaining an operation sequence of the configured multiple interfaces from configuration information input by a user or a pre-stored configuration file; and acquiring the configured test parameter set from the configuration information input by the user.
Optionally, in the process of running the code of each interface of the test case by using the configured test parameter set, the test parameter set is dynamically updated.
According to another aspect of the embodiments of the present invention, an interface testing apparatus is provided.
An interface test apparatus comprising: the configuration acquisition module is used for acquiring the running sequence of the configured plurality of interfaces; and the test execution module is used for executing the test cases of the plurality of interfaces according to the running sequence to generate a test result.
Optionally, the test execution module is further configured to: adding a plurality of interface operation codes of the test case to a pipeline according to the operation sequence; and running each interface running code of the test case by using the configured test parameter set in the pipeline to generate a test result.
Optionally, the configuration obtaining module is further configured to: acquiring the running sequence of the configured interfaces from configuration information input by a user or a pre-stored configuration file; and acquiring the configured test parameter set from the configuration information input by the user.
Optionally, the test execution module includes a parameter update sub-module, configured to dynamically update the test parameter set in a process of running the interface running code of the test case by using the configured test parameter set.
According to yet another aspect of an embodiment of the present invention, an electronic device is provided.
An electronic device, comprising: one or more processors; a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the interface testing method provided by the present invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
A computer-readable medium, on which a computer program is stored, which, when executed by a processor, implements the interface testing method provided by the present invention.
One embodiment of the above invention has the following advantages or benefits: acquiring a running sequence of a plurality of configured interfaces; and executing the test cases of the plurality of interfaces according to the configured running sequence to generate a test result. The sequence of interface test can be flexibly adjusted, thereby simplifying repeated codes. The interface running codes of the test case are added to the pipeline according to the configured running sequence, and the configured test parameter set is used for running the interface running codes of the test case in the pipeline, so that better interface test management is realized, and a better test effect is achieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of an interface testing method according to an embodiment of the present invention;
FIG. 2 is a flow diagram illustrating a multi-interface test flow for multiple scenarios according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a multi-interface testing process according to one embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of an interface testing apparatus according to an embodiment of the present invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 6 is a schematic block diagram of a computer system suitable for use with a server implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of an interface testing method according to an embodiment of the present invention.
As shown in fig. 1, the interface testing method according to the embodiment of the present invention mainly includes the following steps S101 to S102.
Step S101: and acquiring the running sequence of the configured plurality of interfaces.
Specifically, the running sequence of the plurality of interfaces of the configuration may be obtained from configuration information input by a user or a pre-stored configuration file.
Step S102: and executing the test cases of the plurality of interfaces according to the configured running sequence to generate a test result.
Specifically, a plurality of interface running codes of the test case are added to the pipeline according to a running sequence; and in the pipeline, running each interface running code of the test case by using the configured test parameter set to generate a test result.
Wherein the configured set of test parameters may be obtained from configuration information input by a user.
And dynamically updating the test parameter set in the process of running the code of each interface of the test case by using the configured test parameter set.
The interface test flow of the embodiment of the present invention is described in detail below by taking a multi-interface test in a scenario test as an example. In a scene test, a plurality of interfaces are often required to run in sequence to realize corresponding functions of a service scene. According to the embodiment of the invention, different interfaces can be called under various scenes, specifically, the operation sequence of the interfaces and a test parameter pool (parameter pool for short) can be added through user configuration, and then the test case is operated to generate the test report.
FIG. 2 is a flow chart illustrating a multi-interface test of multiple scenarios according to an embodiment of the present invention.
As shown in fig. 2, in the scenario test, a user may configure interface running sequences (sequence 1, sequence 2, … …, sequence n) of test cases according to test requirements, where each sequence corresponds to a scenario. In addition, the user also configures a parameter pool corresponding to the test case, and each parameter in the parameter pool corresponds to a respective interface, so that the parameters in the parameter pool are also ordered, and the order of the parameters corresponds to the operation order of the interfaces.
For each scene in the n scenes of the present example, adding the interface running codes of the test cases to a Pipeline (Pipeline) according to the configured interface running sequence, and running the test cases according to the interface running codes in the Pipeline and the parameters in the parameter pool, so as to call the interfaces according to the interface running sequence configured by the user, and finally generating the test report.
Pipeline (Pipeline), also called Pipeline, is an essential part in modern computer processors, and means that a computer instruction processing process is split into multiple steps, and multiple hardware processing units execute in parallel to speed up instruction execution. In the multi-interface test operation process of the process test, the embodiment of the invention reduces the occurrence rate of repeated codes in each scene test by adjusting the sequence of adding the interface operation codes into the Pipeline and sequencing the operation of the interfaces, and manages the execution of test cases by the Pipeline, so that the interface test can be better managed, the test efficiency is improved, and the workload of testers is saved.
Fig. 3 is a schematic diagram of a multi-interface testing process of a scenario according to an embodiment of the present invention.
As shown in fig. 3, in the multi-interface test flow of a scenario according to the embodiment of the present invention, before a test script is executed separately, an interface running sequence and a parameter pool configured by a user are obtained, where the interface running sequence may also be obtained from a configuration file. And adding the interface operation codes of the test cases into Pipeline according to the obtained interface operation sequence, and operating the test cases. When parameters are updated during operation, then synchronization is performed into the parameter pool. And when the test is finished, producing a corresponding test report. The specific steps include steps S301 to S306 as follows.
Step S301: configuration information input by a user is received.
The configuration information may include user-configured parameter pool data, which is a set of test parameters (test parameter set) required for running a test case, and the test parameter set is stored in the parameter pool a.
The configuration information may further include configured running sequence of each interface, and if the user does not configure the running sequence of each interface in the configuration information, the default configured running sequence of the interface is adopted when the test case is run.
Step S302: and acquiring the running sequence of each interface from the configuration information input by the user, if so, executing the step S304, otherwise, executing the step S303.
Step S303: and acquiring the running sequence of each interface from a pre-stored configuration file.
The pre-stored configuration file stores a default configuration interface operation sequence, and the default configuration interface operation sequence can be configured in advance according to requirements.
Then, step S304 is performed.
Step S304: and adding the running codes of the interfaces of the test case to the pipeline according to the obtained running sequence of the interfaces.
Step S305: and running each interface running code of the test case by using the test parameter set.
In the running process, when the test parameters are updated, the updated parameters are synchronized to the parameter pool a, then the subsequent interface running codes in the test parameter running test case are continuously taken out from the parameter pool a, and when the test case is executed, the step S306 is executed.
Step S306: and generating a test report.
The interface test flow of the embodiment of the invention utilizes the pipeline technology to divide the automatic test process of the multi-interface into a plurality of steps (namely, the sequential test of the plurality of interfaces) and converts the steps into a pipeline mode, so that the test case is more flexible and the code is more concise in each scene.
Fig. 4 is a schematic diagram of main blocks of an interface testing apparatus according to an embodiment of the present invention.
As shown in fig. 4, the interface testing apparatus 400 according to the embodiment of the present invention mainly includes: a configuration acquisition module 401 and a test execution module 402.
The configuration acquiring module 401 is configured to acquire a running sequence of the configured plurality of interfaces.
The configuration obtaining module 401 may specifically obtain the running sequence of the configured multiple interfaces from configuration information input by a user or a pre-stored configuration file; and acquiring the configured test parameter set from the configuration information input by the user.
A test execution module 402, configured to execute the test cases of the multiple interfaces according to the configured running order, so as to generate a test result.
The test execution module 402 may specifically add a plurality of interface running codes of the test case to the pipeline according to the configured running sequence; and in the pipeline, running each interface running code of the test case by using the configured test parameter set to generate a test result.
The test execution module 402 may include a parameter update sub-module, configured to dynamically update the test parameter set during the process of running the interface running codes of the test case by using the configured test parameter set.
In addition, the specific implementation of the interface testing apparatus in the embodiment of the present invention has been described in detail in the above interface testing method, so that repeated descriptions herein will not be repeated.
Fig. 5 illustrates an exemplary system architecture 500 to which the interface testing method or the interface testing apparatus of the embodiments of the present invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the interface testing method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, the interface testing apparatus is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a server according to embodiments of the present application. The server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present application are executed when the computer program is executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a configuration acquisition module 401, a test execution module 402. The names of these modules do not in some cases constitute a limitation on the modules themselves, and for example, the configuration acquisition module 401 may also be described as a "module for acquiring the running order of a plurality of interfaces of a configuration".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a running sequence of a plurality of configured interfaces; and executing the test cases of the plurality of interfaces according to the running sequence to generate a test result.
According to the technical scheme of the embodiment of the invention, the running sequence of the configured multiple interfaces is obtained; and executing the test cases of the plurality of interfaces according to the configured running sequence to generate a test result. The sequence of interface test can be flexibly adjusted, thereby simplifying repeated codes. The interface running codes of the test case are added to the pipeline according to the configured running sequence, and the configured test parameter set is used for running the interface running codes of the test case in the pipeline, so that better interface test management is realized, and a better test effect is achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An interface testing method, comprising:
acquiring a running sequence of a plurality of configured interfaces;
and executing the test cases of the plurality of interfaces according to the running sequence to generate a test result.
2. The method of claim 1, wherein the step of executing the test cases of the plurality of interfaces in the running order to generate test results comprises:
adding a plurality of interface operation codes of the test case to a pipeline according to the operation sequence;
and running each interface running code of the test case by using the configured test parameter set in the pipeline to generate a test result.
3. The method according to claim 2, wherein the running sequence of the configured plurality of interfaces is obtained from configuration information input by a user or a pre-stored configuration file; and acquiring the configured test parameter set from the configuration information input by the user.
4. The method of claim 3, wherein the test parameter set is dynamically updated during the running of the interface running code of the test case with the configured test parameter set.
5. An interface testing apparatus, comprising:
the configuration acquisition module is used for acquiring the running sequence of the configured plurality of interfaces;
and the test execution module is used for executing the test cases of the plurality of interfaces according to the running sequence to generate a test result.
6. The apparatus of claim 5, wherein the test execution module is further configured to:
adding a plurality of interface operation codes of the test case to a pipeline according to the operation sequence;
and running each interface running code of the test case by using the configured test parameter set in the pipeline to generate a test result.
7. The apparatus of claim 6, wherein the configuration acquisition module is further configured to:
acquiring the running sequence of the configured interfaces from configuration information input by a user or a pre-stored configuration file; and acquiring the configured test parameter set from the configuration information input by the user.
8. The apparatus of claim 7, wherein the test execution module comprises a parameter update sub-module, configured to dynamically update the test parameter set during running of the interface running code of the test case with the configured test parameter set.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-4.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN201810862002.XA 2018-08-01 2018-08-01 Interface testing method and device Pending CN110795328A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810862002.XA CN110795328A (en) 2018-08-01 2018-08-01 Interface testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810862002.XA CN110795328A (en) 2018-08-01 2018-08-01 Interface testing method and device

Publications (1)

Publication Number Publication Date
CN110795328A true CN110795328A (en) 2020-02-14

Family

ID=69424909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810862002.XA Pending CN110795328A (en) 2018-08-01 2018-08-01 Interface testing method and device

Country Status (1)

Country Link
CN (1) CN110795328A (en)

Similar Documents

Publication Publication Date Title
CN108733527B (en) System, method and apparatus for testing server functionality
CN108804442B (en) Serial number generation method and device
CN111984616A (en) Method, device and system for updating shared file
CN110007936B (en) Data processing method and device
CN110795328A (en) Interface testing method and device
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
CN111161072A (en) Block chain-based random number generation method, equipment and storage medium
CN111046371A (en) Method, electronic device and computer-readable medium for generating device identification
CN112398669A (en) Hadoop deployment method and device
CN112131095A (en) Pressure testing method and device
CN108984189B (en) Module parsing method and device
CN110391938B (en) Method and apparatus for deploying services
CN109218041B (en) Request processing method and device for server system
CN109840109B (en) Method and apparatus for generating software development toolkit
US11360737B2 (en) Method and apparatus for providing speech service
CN108933695B (en) Method and apparatus for processing information
US20190012138A1 (en) Method and apparatus for providing speech service
CN114157917A (en) Video editing method and device and terminal equipment
CN112084254A (en) Data synchronization method and system
CN113220559A (en) Service interface abnormity simulation method, device and system and client
CN112579447A (en) Browser testing method and device
CN113448652A (en) Request processing method and device
CN113806033A (en) Task execution method, device, server and medium for task system
CN113778847A (en) Test report generation method and device
CN113448602A (en) Version updating method and device

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