CN112579446A - Interface testing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN112579446A
CN112579446A CN202011454568.2A CN202011454568A CN112579446A CN 112579446 A CN112579446 A CN 112579446A CN 202011454568 A CN202011454568 A CN 202011454568A CN 112579446 A CN112579446 A CN 112579446A
Authority
CN
China
Prior art keywords
test
test data
interface
jmeter
controller
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
CN202011454568.2A
Other languages
Chinese (zh)
Inventor
冯艳为
雒冬梅
李庆
邵明雪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Softcom Smart City Technology Co ltd
Original Assignee
Beijing Softcom Smart City 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 Softcom Smart City Technology Co ltd filed Critical Beijing Softcom Smart City Technology Co ltd
Priority to CN202011454568.2A priority Critical patent/CN112579446A/en
Publication of CN112579446A publication Critical patent/CN112579446A/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
    • 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

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)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The embodiment of the invention discloses an interface testing method, an interface testing device, interface testing equipment and a storage medium, wherein the method comprises the following steps: receiving an interface test instruction based on a pressure test tool JMETER; reading test data from a preset test data file according to the interface test instruction based on JMETER; and executing the matched test script according to the test data based on JMETER to obtain a test result. By the technical scheme of the embodiment of the invention, the separation of the test data and the test script is realized, the independent modification and maintenance of the test data and the test script are facilitated, the professional capability requirement on a tester is reduced, programming is not required, and the test script can be set through JMETER as long as the http request is familiar and the business process is familiar.

Description

Interface testing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of testing, in particular to an interface testing method and device, electronic equipment and a storage medium.
Background
The interface test is a test for testing interfaces among system components, and is mainly used for detecting interaction points among external systems, systems and internal subsystems, and the test is mainly used for checking data exchange, transmitting, controlling and managing processes, dependency relationships among system logics and the like.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
all operations related to interface testing are written in one test script, so that the test script comprises test data and an execution script of test logic, and particularly for the test operations of the same interface, a large number of repeated test logic execution scripts exist for different test data, which is not beneficial to the maintenance of the test script.
Disclosure of Invention
The embodiment of the invention provides an interface testing method, an interface testing device, electronic equipment and a storage medium, solves the problem of test script repetition, and is beneficial to maintenance of test scripts and test data.
In a first aspect, an embodiment of the present invention provides an interface testing method, where the method includes:
receiving an interface test instruction based on a pressure test tool JMETER;
reading test data from a preset test data file according to the interface test instruction based on JMETER;
and executing the matched test script according to the test data based on JMETER to obtain a test result.
Further, before receiving the interface test instruction based on the JMETER pressure test tool, the method further includes:
creating a cycle controller through JMETER, wherein the cycle times of the cycle controller are the same as the quantity of the test data in the test data file;
and adding preset associated information of the test data file under the circulation controller so that the circulation controller reads test data from the test data file according to an interface test instruction during interface test.
Further, the associated information of the preset test data file includes: and testing the storage path of the data file, the file code and the variable name corresponding to the test data.
Further, before receiving the interface test instruction based on the JMETER pressure test tool, the method further includes:
and respectively adding a first controller and a second controller under the cyclic controller, wherein the first controller is used for performing interface test based on test data adopting a first request mode, and the second controller is used for performing interface test based on test data adopting a second request mode.
Further, the first request mode includes a get mode, and the second request mode includes a post mode.
Further, the executing the matched test script according to the test data based on JMETER to obtain a test result includes:
determining a request mode adopted by the test data;
if the request mode adopted by the test data is a first request mode, executing a matched test script through the first controller;
and if the request mode adopted by the test data is a second request mode, executing the matched test script through the second controller.
Further, the executing, by the first controller, the matched test script includes:
assigning the test data to corresponding variables in the test script;
executing the test script based on the assigned variables.
In a second aspect, an embodiment of the present invention further provides an interface testing apparatus, where the apparatus includes:
the receiving module is used for receiving an interface test instruction based on a JMETER (JMETER) pressure test tool;
the reading module is used for reading test data from a preset test data file based on JMETER according to the interface test instruction;
and the test module is used for executing the matched test script according to the test data based on JMETER to obtain a test result.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the interface test method steps as provided by any of the embodiments of the invention.
In a fourth aspect, embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the interface testing method provided in any embodiment of the present invention.
The embodiment of the invention has the following advantages or beneficial effects:
the interface test is carried out by means of a JMETER, so that the separation of test data and test scripts is realized, the independent modification and maintenance of the test data and the test scripts are facilitated, the professional ability requirements on testers are reduced, programming is not needed, and the test scripts can be set by the JMETER as long as the http request is familiar and the business process is familiar.
Drawings
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention;
FIG. 2 is a diagram of test data stored in a CSV file according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an interface for adding a first controller under the cycle controller according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an interface for adding an http request under a first controller if _ get according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an interface for adding a second controller under the cycle controller according to an embodiment of the present invention;
fig. 6 is a schematic interface diagram of adding an http request under the second controller if _ post according to an embodiment of the present invention;
fig. 7 is a schematic interface diagram of adding an http message management header according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an interface for adding an assertion to each http request according to an embodiment of the present invention;
FIG. 9 is a schematic interface diagram of a directory hierarchy structure provided in an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an interface testing apparatus according to a second embodiment of the present invention;
fig. 11 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention, which is applicable to interface testing based on a pressure testing tool JMETER. The method may be performed by an interface testing apparatus, which may be implemented by means of software and/or hardware.
As shown in fig. 1, the method specifically includes the following steps:
and step 110, receiving an interface test instruction based on a JMETER pressure test tool.
JMETER is a JAVA-based pressure testing tool developed by Apache organization, and can be used for testing the performance of static and dynamic resources (static files, Java servlets, Perl scripts, CGI scripts, Java objects, databases, FTP servers and the like); it can also be used to simulate huge loads on servers, networks or objects, test their strengths and analyze the overall performance from different stress classes. In addition, JMETER can perform a function/regression test on an application to verify whether the program under test returns the expected result by creating a script with an assertion. For maximum flexibility, JMETER allows assertions to be created using regular expressions.
And 120, reading test data from a preset test data file according to the interface test instruction based on JMETER.
Specifically, the preset test data file may specifically be a CSV (Comma-Separated Values) file. In this embodiment, test data is saved in a CSV (Comma-Separated Values) file, a test script is edited by a JMETER, and then the test data in the CSV file is called by the JMETER, and different test scripts in the JMETER are controlled to execute test logic by different test data. The test engineer does not need to create a separate test script for each input test data, and the input test data and the expected result are read from the CSV file, so that the test script is separated from the test data, thereby greatly reducing the repeat quantity of the test script, reducing the development and maintenance cost of the test script, and facilitating the modification and maintenance of the test script. Specifically, in order to realize the separation of the test data and the test script, in the test script, a variable is used for replacing a place where the test data needs to be input, then the test data is uniformly stored in the CSV file, when the test script reads a line of test data in the CSV file, the test data is assigned to a corresponding variable, then a test case is executed, then the next line of test data in the CSV file is read, after all lines of test data are read, the test is finished, the number of lines of test data in the CSV file is several, and the test case is executed for several times.
For example, reference may be made to a schematic diagram of test data stored in a CSV file as shown in fig. 2, where the test data is stored in the CSV file through an excel table, and the meaning of the data in the left-to-right cells is: test case sequence number caseSeq (e.g., C001, C002, C003), API Request apiType (e.g., https), API version apiSeq (e.g., v001), API name apiName (e.g., GET Request, POST Request), priority, Request methods (e.g., GET, POST), parameter param, and expected value expectValue.
And step 130, executing the matched test script according to the test data based on JMETER to obtain a test result.
The interface test is to simulate the sending and receiving of HTTP requests through tools or codes to test whether data exchange between a client and a server is normal, and is generally used for detecting connectivity between an external system and an internal system. The code testing method has higher requirement on professional ability of testers, and simulation testing based on a testing tool is relatively simple, in the embodiment, the interface testing is realized by utilizing a CSV file and a JMETER, the CSV file is used for storing test data and test cases, the JMETER is used for storing test scripts, the test data in the CSV file is read, and the test scripts stored in the JMETER are driven through the test data.
Further, before receiving the interface test instruction based on the JMETER pressure test tool, the method further includes:
creating a cycle controller through JMETER, wherein the cycle times of the cycle controller are the same as the quantity of the test data in the test data file;
and adding preset associated information of the test data file under the circulation controller so that the circulation controller reads test data from the test data file according to an interface test instruction during interface test.
The associated information of the preset test data file comprises: and testing the storage path of the data file, the file code and the variable name corresponding to the test data.
Before receiving an interface test instruction based on a pressure test tool JMETER, the method further comprises the following steps:
and respectively adding a first controller and a second controller under the cyclic controller, wherein the first controller is used for performing interface test based on test data adopting a first request mode, and the second controller is used for performing interface test based on test data adopting a second request mode.
The first request mode comprises a get mode, and the second request mode comprises a post mode. The get mode refers to acquiring data from a server, and the post mode refers to sending data to the server. Different service logic branches of JMETER are correspondingly driven through different request modes, namely different test scripts, and an interface test scheme based on data driving is realized.
Specifically, the first controller may be named if _ get, that is, if the request mode in the read test data is get, the test script in the first controller is executed, and the second controller may be named if _ post, that is, if the request mode in the read test data is post, the test script in the second controller is executed. It can be understood that the first controller and the second controller are self-contained JMETER functional components, and a tester only needs to perform corresponding setting through JMETER.
Correspondingly, referring to an interface schematic diagram of adding a first controller under the loop controller shown in fig. 3, the purpose of adding the first controller is to execute a test script in the first controller if the request mode in the read test data is get. Specifically, an http request is added under the first controller if _ get, and the naming rule is $ { caseSeq } _$ { apiSeq } _ $ { apiName }, i.e., the name of the case number _ API version _ API, so that the naming mode is more intuitive and is convenient for a tester to understand. A corresponding interface diagram for adding an http request under the first controller if _ get is shown with reference to fig. 4. Wherein, $ { apiType } -, https is an API request protocol; com is defined in the user-defined variable; $ url ═ get; $ param ═ foo1 ═ bar 1; the splicing is complete as follows: https:// postman-echo.com/getfoo1 bar 1.
Further, referring to an interface schematic diagram of adding a second controller under the loop controller shown in fig. 5, the purpose of adding the second controller is to execute a test script in the second controller if the request mode in the read test data is post. Specifically, an http request is added under the second controller if _ post, and the naming rule is $ { caseSeq } _$ { apiSeq } _ _ $ { apiName }, i.e., the name of the case number _ API version _ API, so that the naming mode is more intuitive and is convenient for a tester to understand. A corresponding interface diagram for adding an http request under the second controller if _ post, as described with reference to fig. 6, is shown. Wherein, { [ param } - { "foo1": bar1"," foo2": bar2" }. The splice complete request is https:// postman-echo. com/postPOST data { "foo1": bar1"," foo2": bar2" }. Because the method is a post method, the reference method is different from the get method, and therefore an http message management header needs to be declared under the http. Correspondingly, refer to the schematic interface diagram of adding the http information management header shown in fig. 7. Then add an assertion to each http request, i.e. the expected result, and refer to a corresponding interface diagram of fig. 8 for adding an assertion to each http request, although their expected values are all the variables $ { expectValue }, the actual values are different. Finally, a corresponding listener is added and the directory hierarchy is shown with reference to FIG. 9.
Illustratively, the executing the matched test script according to the test data based on JMETER to obtain the test result includes:
determining a request mode adopted by the test data;
if the request mode adopted by the test data is a first request mode, executing a matched test script through the first controller;
and if the request mode adopted by the test data is a second request mode, executing the matched test script through the second controller.
Specifically, the executing the matched test script by the first controller includes:
assigning the test data to corresponding variables in the test script;
executing the test script based on the assigned variables.
In order to realize the separation of the test data and the test script, in the test script, a variable is used for replacing a place where the test data needs to be input, then the test data is uniformly stored in a CSV file, when the test script reads a line of test data in the CSV file, the test data is assigned to a corresponding variable, then a test case is executed, then the next line of test data in the CSV file is read, and after all lines of test data are read, the test is finished
According to the technical scheme of the embodiment, the interface test is carried out by means of the JMETER, so that the separation of the test data and the test script is realized, the independent modification and maintenance of the test data and the test script are facilitated, the professional ability requirement on a tester is reduced, programming is not needed, and the test script can be set through the JMETER as long as the http request is familiar and the business process is familiar. Different service logic branches of JMETER are correspondingly driven through different request modes, namely different test scripts, and an interface test scheme based on data driving is realized.
The following is an embodiment of an interface testing apparatus provided in an embodiment of the present invention, which belongs to the same inventive concept as the interface testing methods in the above embodiments, and details that are not described in detail in the embodiment of the interface testing apparatus may refer to the embodiment of the interface testing method.
Example two
Fig. 10 is a schematic structural diagram of an interface testing apparatus according to a second embodiment of the present invention, where the apparatus specifically includes: a receiving module 1010, a reading module 1020, and a testing module 1030.
The receiving module 1010 is used for receiving an interface test instruction based on a pressure test tool JMETER; a reading module 1020, configured to read test data from a preset test data file according to the interface test instruction based on JMETER; and the test module 1030 is configured to execute the matched test script according to the test data based on JMETER, so as to obtain a test result.
Further, the apparatus further comprises:
the creating module is used for creating a cycle controller through a JMETER before receiving an interface test instruction based on the JMETER, wherein the cycle times of the cycle controller are the same as the quantity of test data in the test data file;
the first adding module is used for adding the associated information of a preset test data file under the cycle controller so as to enable the cycle controller to read test data from the test data file according to an interface test instruction during interface test.
Further, the associated information of the preset test data file includes: and testing the storage path of the data file, the file code and the variable name corresponding to the test data.
Further, the apparatus further comprises: and the second adding module is used for respectively adding a first controller and a second controller under the cycle controller before receiving an interface test instruction based on a pressure test tool JMETER, wherein the first controller is used for performing interface test based on test data adopting a first request mode, and the second controller is used for performing interface test based on test data adopting a second request mode.
Further, the first request mode includes a get mode, and the second request mode includes a post mode.
Further, the test module 1030 includes:
the determining unit is used for determining a request mode adopted by the test data;
the execution unit is used for executing the matched test script through the first controller if the request mode adopted by the test data is a first request mode; and if the request mode adopted by the test data is a second request mode, executing the matched test script through the second controller.
Further, the execution unit is specifically configured to:
assigning the test data to corresponding variables in the test script;
executing the test script based on the assigned variables.
According to the technical scheme of the embodiment, the interface test is carried out by means of the JMETER, so that the separation of the test data and the test script is realized, the independent modification and maintenance of the test data and the test script are facilitated, the professional ability requirement on a tester is reduced, programming is not needed, and the test script can be set through the JMETER as long as the http request is familiar and the business process is familiar. Different service logic branches of JMETER are correspondingly driven through different request modes, namely different test scripts, and an interface test scheme based on data driving is realized.
The interface testing device provided by the embodiment of the invention can execute the interface testing method provided by any embodiment of the invention, and has the corresponding functional module and beneficial effect of executing the interface testing method.
EXAMPLE III
Fig. 11 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. FIG. 11 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention. The electronic device 12 shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 11, electronic device 12 is embodied in the form of a general purpose computing electronic device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 11, and commonly referred to as a "hard drive"). Although not shown in FIG. 11, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and interface tests by running a program stored in the system memory 28, for example, to implement the steps of an interface test method provided by the embodiment of the present invention, the method includes:
receiving an interface test instruction based on a pressure test tool JMETER;
reading test data from a preset test data file according to the interface test instruction based on JMETER;
and executing the matched test script according to the test data based on JMETER to obtain a test result.
Of course, those skilled in the art can understand that the processor can also implement the technical solution of the interface testing method provided by any embodiment of the present invention.
Example four
A fourth embodiment provides a computer-readable storage medium, on which a computer program is stored, the program, when executed by a processor, implementing the steps of the interface testing method provided in any embodiment of the present invention, the method including:
receiving an interface test instruction based on a pressure test tool JMETER;
reading test data from a preset test data file according to the interface test instruction based on JMETER;
and executing the matched test script according to the test data based on JMETER to obtain a test result.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: 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 context of this document, 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.
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.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented by program code executable by a computing device, such that it may be stored in a memory device and executed by a computing device, or it may be separately fabricated into various integrated circuit modules, or it may be fabricated by fabricating a plurality of modules or steps thereof into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An interface testing method, comprising:
receiving an interface test instruction based on a pressure test tool JMETER;
reading test data from a preset test data file according to the interface test instruction based on JMETER;
and executing the matched test script according to the test data based on JMETER to obtain a test result.
2. The method of claim 1, wherein before receiving the interface test command based on the JMETER pressure test tool, the method further comprises:
creating a cycle controller through JMETER, wherein the cycle times of the cycle controller are the same as the quantity of the test data in the test data file;
and adding preset associated information of the test data file under the circulation controller so that the circulation controller reads test data from the test data file according to an interface test instruction during interface test.
3. The method of claim 2, wherein the association information of the preset test data file comprises: and testing the storage path of the data file, the file code and the variable name corresponding to the test data.
4. The method of claim 2, wherein before receiving the interface test command based on the JMETER pressure test tool, the method further comprises:
and respectively adding a first controller and a second controller under the cyclic controller, wherein the first controller is used for performing interface test based on test data adopting a first request mode, and the second controller is used for performing interface test based on test data adopting a second request mode.
5. The method of claim 4, wherein the first request mode comprises a get mode and the second request mode comprises a post mode.
6. The method of claim 4, wherein the performing the matched test script according to the test data based on JMETER to obtain the test result comprises:
determining a request mode adopted by the test data;
if the request mode adopted by the test data is a first request mode, executing a matched test script through the first controller;
and if the request mode adopted by the test data is a second request mode, executing the matched test script through the second controller.
7. The method of claim 6, wherein executing, by the first controller, the matched test script comprises:
assigning the test data to corresponding variables in the test script;
executing the test script based on the assigned variables.
8. An interface testing apparatus, comprising:
the receiving module is used for receiving an interface test instruction based on a JMETER (JMETER) pressure test tool;
the reading module is used for reading test data from a preset test data file based on JMETER according to the interface test instruction;
and the test module is used for executing the matched test script according to the test data based on JMETER to obtain a test result.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the interface test method steps of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the interface testing method steps of any one of claims 1 to 7.
CN202011454568.2A 2020-12-10 2020-12-10 Interface testing method and device, electronic equipment and storage medium Pending CN112579446A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011454568.2A CN112579446A (en) 2020-12-10 2020-12-10 Interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011454568.2A CN112579446A (en) 2020-12-10 2020-12-10 Interface testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112579446A true CN112579446A (en) 2021-03-30

Family

ID=75131365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011454568.2A Pending CN112579446A (en) 2020-12-10 2020-12-10 Interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112579446A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282499A (en) * 2021-05-31 2021-08-20 长沙市到家悠享家政服务有限公司 Method, system, device and medium for creating test data
CN113760759A (en) * 2021-09-02 2021-12-07 广东睿住智能科技有限公司 Debugging method, debugging device, electronic device, and storage medium
CN113778835A (en) * 2021-11-11 2021-12-10 广州粤芯半导体技术有限公司 Pressure testing method
CN114860617A (en) * 2022-07-06 2022-08-05 上海金仕达软件科技有限公司 Intelligent pressure testing method and system
CN117112391A (en) * 2022-11-15 2023-11-24 领悦数字信息技术有限公司 Method and system for functional testing

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201862A (en) * 2015-05-25 2016-12-07 阿里巴巴集团控股有限公司 Web services method for testing pressure and device
CN109189684A (en) * 2018-08-28 2019-01-11 四川长虹电器股份有限公司 Automatic interface testing method based on Python
CN111427765A (en) * 2020-02-17 2020-07-17 叮当快药科技集团有限公司 Method and system for automatically starting interface performance test realized based on jmeter
CN111625464A (en) * 2020-05-28 2020-09-04 杭州鸿雁电器有限公司 Interface test method and device, storage medium and processor
CN111651365A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 Automatic interface testing method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201862A (en) * 2015-05-25 2016-12-07 阿里巴巴集团控股有限公司 Web services method for testing pressure and device
CN109189684A (en) * 2018-08-28 2019-01-11 四川长虹电器股份有限公司 Automatic interface testing method based on Python
CN111427765A (en) * 2020-02-17 2020-07-17 叮当快药科技集团有限公司 Method and system for automatically starting interface performance test realized based on jmeter
CN111625464A (en) * 2020-05-28 2020-09-04 杭州鸿雁电器有限公司 Interface test method and device, storage medium and processor
CN111651365A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 Automatic interface testing method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一步一脚印丶: ""JMeter-接口自动化测试(数据驱动)"", pages 1 - 6, Retrieved from the Internet <URL:https://www.cnblogs.com/zhangwuxuan/p/12416311.html> *
小黑测试员: ""selenium UI自动化测试之设计模式Page Object+脚本与测试数据分离"", pages 1 - 3, Retrieved from the Internet <URL:https://blog.csdn.net/u012002125/article/details/107452511> *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113282499A (en) * 2021-05-31 2021-08-20 长沙市到家悠享家政服务有限公司 Method, system, device and medium for creating test data
CN113282499B (en) * 2021-05-31 2024-02-09 长沙市到家悠享家政服务有限公司 Method, system, equipment and medium for creating test data
CN113760759A (en) * 2021-09-02 2021-12-07 广东睿住智能科技有限公司 Debugging method, debugging device, electronic device, and storage medium
CN113778835A (en) * 2021-11-11 2021-12-10 广州粤芯半导体技术有限公司 Pressure testing method
CN114860617A (en) * 2022-07-06 2022-08-05 上海金仕达软件科技有限公司 Intelligent pressure testing method and system
CN117112391A (en) * 2022-11-15 2023-11-24 领悦数字信息技术有限公司 Method and system for functional testing

Similar Documents

Publication Publication Date Title
CN112579446A (en) Interface testing method and device, electronic equipment and storage medium
CN109522228B (en) Interface automation test data construction method, device, platform and storage medium
CN110806970A (en) Client test method and device based on simulation server response and electronic equipment
JP2012123789A (en) Parallel work load simulation for application performance test
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN112631919A (en) Comparison test method and device, computer equipment and storage medium
CN114138674A (en) Automatic testing method and device and computer equipment
US10489259B2 (en) Replicating test case data into a cache with non-naturally aligned data boundaries
CN111309621A (en) Interface test method, system, equipment and storage medium
CN112988588B (en) Client software debugging method and device, storage medium and electronic equipment
CN112860538A (en) Method and device for performing interface regression test based on online log
CN112463574A (en) Software testing method, device, system, equipment and storage medium
CN115509925A (en) Automatic interface testing method and related device
US10169180B2 (en) Replicating test code and test data into a cache with non-naturally aligned data boundaries
CN114978923A (en) Fault drilling method, device and system
CN113360365B (en) Flow test method and flow test system
CN113176993A (en) Case testing method and device, electronic equipment and storage medium
US10055320B2 (en) Replicating test case data into a cache and cache inhibited memory
CN110825438B (en) Method and device for simulating data processing of artificial intelligence chip
US20230236956A1 (en) Objective-driven test cases and suites
CN113448822B (en) Test method, test device, computer readable medium and electronic equipment
CN112532747B (en) Method, apparatus, device and storage medium for outputting information
CN114416571A (en) Interface testing method, device, equipment and storage medium
CN118012756A (en) Data testing method and device for big data processing platform
CN117112433A (en) System testing method and device based on JMeter, 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