CN109634841B - Electronic device, interface automatic test method and storage medium - Google Patents

Electronic device, interface automatic test method and storage medium Download PDF

Info

Publication number
CN109634841B
CN109634841B CN201811256478.5A CN201811256478A CN109634841B CN 109634841 B CN109634841 B CN 109634841B CN 201811256478 A CN201811256478 A CN 201811256478A CN 109634841 B CN109634841 B CN 109634841B
Authority
CN
China
Prior art keywords
interface
document
test
attribute information
jmeter
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.)
Active
Application number
CN201811256478.5A
Other languages
Chinese (zh)
Other versions
CN109634841A (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811256478.5A priority Critical patent/CN109634841B/en
Publication of CN109634841A publication Critical patent/CN109634841A/en
Application granted granted Critical
Publication of CN109634841B publication Critical patent/CN109634841B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a test case, and provides an automatic interface test method, which comprises the following steps: after receiving an interface test instruction, acquiring attribute information of the interface; correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface; converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts; and executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script. The efficiency and the accuracy of interface test can be improved, and the labor cost is saved. The invention also provides an electronic device and a storage medium.

Description

Electronic device, interface automatic test method and storage medium
Technical Field
The present invention relates to the field of automated interface testing, and in particular, to an electronic device, an automated interface testing method, and a storage medium.
Background
During interface testing, it is often necessary to write test scripts from an interface document. The interface document is used to describe properties of the interface, such as a format describing input parameters of the interface, a format of output parameters, or a communication protocol. Typically, in an interface development process, a developer writes an interface document corresponding to an interface, so that other developers can clearly understand the corresponding interface through the interface document. At present, because the interface and the interface document are separately written, and the interface document is written in a non-uniform specified format, in the interface test process, the interface attribute corresponding to the interface document needs to be continuously communicated with a developer to know, so that an interface test script which can be accurately executed can be written, the whole process not only consumes a great deal of manpower, but also can generate the phenomenon that the interface document is inconsistent with the interface attribute, thereby having low test efficiency and being easy to generate test errors.
Disclosure of Invention
In view of this, the present invention provides an electronic device, an automated interface testing method and a storage medium, which can improve the efficiency and accuracy of interface testing and save labor cost.
First, in order to achieve the above object, the present invention provides an electronic device, which includes a memory, and a processor connected to the memory, wherein the processor is configured to execute an interface automation test program stored on the memory, and the interface automation test program when executed by the processor implements the following steps:
a1, after receiving an interface test instruction, acquiring attribute information of the interface;
a2, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
a3, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
and A4, executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script.
Preferably, in the step A1, the step of obtaining attribute information of the interface includes:
acquiring interface data corresponding to the interface;
and analyzing the interface data to analyze attribute information of the interface.
Preferably, in the step A2, the pre-stored interface document template is an EXCEL document, and an interface attribute information adding frame is set in the EXCEL document; the step A2 comprises the following steps:
and correspondingly adding the attribute information of the interface to an adding frame arranged in the EXCEL document, and generating an interface document of the interface.
Preferably, in the step A3, the conversion rule corresponding to the predetermined interface document and the Jmeter test script is:
a. converting the interface names contained in the interface document into the test case names of the target test script; specifically, each interface name corresponds to a test case name;
b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script;
c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script;
d. converting the request parameters in the interface document into an 'image value' in the Jmeter script;
e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
Preferably, in the step A1, the attribute information of the interface includes: interface name, uniform resource locator, request parameter, request mode and output parameter.
In addition, in order to achieve the above purpose, the invention also provides an automatic interface testing method, which comprises the following steps:
s1, after receiving an interface test instruction, acquiring attribute information of an interface;
s2, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
s3, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
s4, executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script.
Preferably, in the step S1, the step of obtaining attribute information of the interface includes:
acquiring interface data corresponding to the interface;
and analyzing the interface data to analyze attribute information of the interface.
Preferably, in the step S2, the pre-stored interface document template is an EXCEL document, and an interface attribute information adding box is set in the EXCEL document; the step A2 comprises the following steps:
and correspondingly adding the attribute information of the interface to an adding frame arranged in the EXCEL document, and generating an interface document of the interface.
Preferably, in the step S3, the conversion rule corresponding to the predetermined interface document and the Jmeter test script is:
a. converting the interface names contained in the interface document into the test case names of the target test script; specifically, each interface name corresponds to a test case name;
b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script;
c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script;
d. converting the request parameters in the interface document into an 'image value' in the Jmeter script;
e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
Furthermore, to achieve the above object, the present invention also proposes a computer-readable storage medium storing an interface automation test program executable by at least one processor to cause the at least one processor to perform the steps of the interface automation test method as described above.
According to the electronic device, the interface automatic test method and the storage medium, after receiving the interface test instruction, attribute information of the interface is obtained; correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface; converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts; and executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script. The efficiency and the accuracy of interface test can be improved, and the labor cost is saved.
Drawings
FIG. 1 is a schematic diagram of an alternative hardware architecture of an electronic device according to the present invention;
FIG. 2 is a schematic diagram of a program module for automated testing of interfaces in an embodiment of an electronic device according to the present invention;
FIG. 3 is a flow chart illustrating the implementation of a preferred embodiment of the automated interface test method of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the description of "first", "second", etc. in this disclosure is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implying an indication of the number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent and not within the scope of protection claimed in the present invention.
Referring to fig. 1, an alternative hardware architecture of the electronic device according to the present invention is shown. In this embodiment, the electronic device 10 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 that may be communicatively connected to each other via a communication bus 14. It should be noted that fig. 1 only shows an electronic device 10 having components 11-14, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may alternatively be implemented.
The memory 11 includes at least one type of computer-readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 10, such as a hard disk or a memory of the electronic device 10. In other embodiments, the memory 11 may also be an external storage device of the electronic apparatus 10, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the electronic apparatus 10. Of course, the memory 11 may also include both internal memory units of the electronic apparatus 10 and external memory devices thereof. In this embodiment, the memory 11 is generally used for storing an operating system and various application software installed in the electronic device 10, such as an interface automation test program. Further, the memory 11 may be used to temporarily store various types of data that have been output or are to be output.
Processor 12 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 12 is generally used to control the overall operation of the electronic device 10. In this embodiment, the processor 12 is configured to run program codes stored in the memory 11 or process data, such as a running interface automation test program or the like.
The network interface 13 may comprise a wireless network interface or a wired network interface, the network interface 13 typically being used to establish a communication connection between the electronic apparatus 10 and other electronic devices.
The communication bus 14 is used to enable communication connections between the components 11-13.
Fig. 1 shows only an electronic device 10 having components 11-14 and interface automation testing, but it is to be understood that not all of the illustrated components are required to be implemented and that more or fewer components may alternatively be implemented.
Optionally, the electronic device 10 may also comprise a user interface (not shown in fig. 1), which may comprise a display, an input unit such as a keyboard, wherein the user interface may also comprise a standard wired interface, a wireless interface, etc.
Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED touch, or the like. Further, the display may also be referred to as a display screen or display unit for displaying information processed in the electronic device 10 and for displaying a visual user interface.
Optionally, in some embodiments, the electronic device 10 may further include an audio unit (not shown in fig. 1) that may convert received or stored audio data into an audio signal when the electronic device 10 is in a call signal receiving mode, a talk mode, a recording mode, a speech recognition mode, a broadcast receiving mode, etc.; further, the electronic device 10 may also include an audio output unit that outputs audio signals converted by the audio unit, and may also provide audio outputs (e.g., call signal receiving sounds, message receiving sounds, etc.) related to particular functions performed by the electronic device 10, which may include speakers, buzzers, etc.
Optionally, in some embodiments, the electronic device 10 may further comprise an alarm unit (not shown in the figures), which may provide an output to inform the electronic device 10 about the occurrence of an event. Typical events may include call reception, message reception, key signal input, touch input, and so forth. In addition to audio or video output, the alarm unit may provide output in different ways to notify of the occurrence of an event. For example, the alert unit may provide an output in the form of a vibration, and when a call, message, or some other message is received that may cause the electronic device 10 to enter a communication mode, the alert unit may provide a tactile output (i.e., vibration) to notify the user thereof.
In one embodiment, the interface automation test program stored in memory 11, when executed by processor 12, performs the following operations:
a1, after receiving an interface test instruction, acquiring attribute information of the interface;
specifically, in this embodiment, the interface may be any application programming interface (Application Programming Interface, API) that has been developed, and the API may implement intercommunication between different functional layers of the same system. Generally, a developer can develop various interfaces for implementing different functions according to actual requirements. It will be appreciated that when developing an interface (i.e., writing an interface program), a developer may make corresponding annotations to the interface program to provide a basis for subsequent generation of corresponding interface documents from the annotated interface program. In this embodiment, annotating the interface program specifically includes annotating and interpreting attribute information of the interface. The attribute information of the interface includes, but is not limited to, the name of the interface, the uniform resource locator (Unif o rm Resource Locator, URL) of the interface, the request parameter (RequestBody) of the interface, the request mode of the interface, the output parameter of the interface, and the like.
Specifically, the step of obtaining attribute information of the interface includes: acquiring interface data corresponding to the interface; and analyzing the interface data to analyze attribute information of the interface. It can be appreciated that in the interface development process, a developer can annotate the interface program according to a preset annotation mode. The preset annotation mode can be set according to actual requirements, and is not limited herein. For example, the preset annotation mode may be a Hibernate Validator annotation tool, or the preset annotation mode may be a developer-customized annotation mode. In the embodiment of the invention, the interface data is generated according to the annotated interface program, the interface data is used for describing attribute information of the interface, and the interface data is data in a preset format. The preset format may be set according to actual requirements, which is not limited herein. For example, the preset format may be a javascript object notation (JavaScript Object Notation, JSON) format, which is a lightweight text data interchange format that uses javascript syntax to describe a data object, which is more easily understood. Further, the annotated interface program can be converted into the corresponding interface data in JSON format through the JSON parser in advance, and the interface data corresponding to the interface can be stored locally. After receiving an interface test instruction, interface data corresponding to the interface can be obtained locally; and analyzing the interface data to analyze attribute information of the interface. Specifically, the interface data is parsed according to a parsing scheme corresponding to the format of the interface data. For example, if the interface data is JSON format data, a JSON parser may be used to parse the interface data, and then obtain attribute information of the interface after parsing the interface data.
A2, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
specifically, in this embodiment, the pre-stored interface document template may be set according to actual requirements, which is not limited herein. For example, the pre-stored interface document template may be an EXCEL document, in which an interface attribute information adding frame such as an interface name, an interface environment, an interface URL, an interface request mode, an interface request parameter, an interface output parameter, etc. is set, and the attribute information of the interface is correspondingly added to the adding frame set in the EXCEL document, so as to generate an interface document of the interface.
A3, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the Jmeter test scripts;
specifically, the conversion rule corresponding to the predetermined interface document and the Jmeter test script is:
a. converting the interface names contained in the interface document into the test case names of the target test script; specifically, each interface name corresponds to a test case name;
b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script;
c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script;
d. converting the request parameters in the interface document into an 'image value' in the Jmeter script;
e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
Further, if the interface document further includes a summary portion, converting the summary portion in the interface document into a public portion of the Jmeter test script; for example:
testclass= "Cookie manager" testname= "HTTP Cookie manager";
b.testclass= "HeaderManager" testname= "HTTP header manager";
testclass= "LoopController" testname= "HTTP request default";
further, if the interface document also comprises a document name, converting the document name into a script name of the Jmeter test script;
further, if the interface document further includes an interface environment, converting the interface environment into "http sample/domain" and "http sample/port" in the Jmeter test script;
further, if the interface document further includes an interface description, the interface description is converted into a "response assertion" in the Jmeter script;
and A4, executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script.
As can be seen from the above-mentioned practical embodiment, the electronic device provided by the present invention obtains the attribute information of the interface after receiving the interface test instruction; correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface; converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts; and executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script. The efficiency and the accuracy of interface test can be improved, and the labor cost is saved.
In addition, the interface automation test of the present invention may be described using program modules having the same function depending on the functions implemented in each part thereof. Fig. 2 is a schematic diagram of a program module for automated testing of interfaces in an electronic device according to an embodiment of the invention. In this embodiment, the interface automation test may be divided into an acquisition module 201, an addition module 202, a conversion module 203 and an execution module 204 according to the functions implemented by the parts. As will be appreciated from the above description, program modules in accordance with the present invention refer to a series of computer program instruction segments capable of performing particular functions, and are more suited to describing the execution of an interface automation test program in electronic device 10 than the program. The functions or operational steps performed by the modules 201-204 are similar to those described above and are not described in detail herein, for example, wherein:
the obtaining module 201 is configured to obtain attribute information of the interface after receiving an interface test instruction;
the adding module 202 is configured to correspondingly add the attribute information of the interface to a pre-stored interface document template, and generate an interface document of the interface;
the conversion module 203 is configured to convert interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
the execution module 204 is configured to execute the Jmeter test script and generate a test report based on an execution result of the Jmeter test script.
In addition, the invention also provides an automatic interface testing method, referring to fig. 3, comprising the following steps:
s301, after receiving an interface test instruction, acquiring attribute information of the interface;
specifically, in this embodiment, the interface may be any application programming interface (Application Programming Interface, API) that has been developed, and the API may implement intercommunication between different functional layers of the same system. Generally, a developer can develop various interfaces for implementing different functions according to actual requirements. It will be appreciated that when developing an interface (i.e., writing an interface program), a developer may make corresponding annotations to the interface program to provide a basis for subsequent generation of corresponding interface documents from the annotated interface program. In this embodiment, annotating the interface program specifically includes annotating and interpreting attribute information of the interface. The attribute information of the interface includes, but is not limited to, the name of the interface, the uniform resource locator (Unif o rm Resource Locator, URL) of the interface, the request parameter (RequestBody) of the interface, the request mode of the interface, the output parameter of the interface, and the like.
Specifically, the step of obtaining attribute information of the interface includes: acquiring interface data corresponding to the interface; and analyzing the interface data to analyze attribute information of the interface. It can be appreciated that in the interface development process, a developer can annotate the interface program according to a preset annotation mode. The preset annotation mode can be set according to actual requirements, and is not limited herein. For example, the preset annotation mode may be a Hibernate Validator annotation tool, or the preset annotation mode may be a developer-customized annotation mode. In the embodiment of the invention, the interface data is generated according to the annotated interface program, the interface data is used for describing attribute information of the interface, and the interface data is data in a preset format. The preset format may be set according to actual requirements, which is not limited herein. For example, the preset format may be a javascript object notation (JavaScript Object Notation, JSON) format, which is a lightweight text data interchange format that uses javascript syntax to describe a data object, which is more easily understood. Further, the annotated interface program can be converted into the corresponding interface data in JSON format through the JSON parser in advance, and the interface data corresponding to the interface can be stored locally. After receiving an interface test instruction, interface data corresponding to the interface can be obtained locally; and analyzing the interface data to analyze attribute information of the interface. Specifically, the interface data is parsed according to a parsing scheme corresponding to the format of the interface data. For example, if the interface data is JSON format data, a JSON parser may be used to parse the interface data, and then obtain attribute information of the interface after parsing the interface data.
S302, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
specifically, in this embodiment, the pre-stored interface document template may be set according to actual requirements, which is not limited herein. For example, the pre-stored interface document template may be an EXCEL document, in which an interface attribute information adding frame such as an interface name, an interface environment, an interface URL, an interface request mode, an interface request parameter, an interface output parameter, etc. is set, and the attribute information of the interface is correspondingly added to the adding frame set in the EXCEL document, so as to generate an interface document of the interface.
S303, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the Jmeter test scripts;
specifically, the conversion rule corresponding to the predetermined interface document and the Jmeter test script is:
a. converting the interface names contained in the interface document into the test case names of the target test script; specifically, each interface name corresponds to a test case name;
b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script;
c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script;
d. converting the request parameters in the interface document into an 'image value' in the Jmeter script;
e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
Further, if the interface document further includes a summary portion, converting the summary portion in the interface document into a public portion of the Jmeter test script; for example:
testclass= "Cookie manager" testname= "HTTP Cookie manager";
b.testclass= "HeaderManager" testname= "HTTP header manager";
testclass= "LoopController" testname= "HTTP request default";
further, if the interface document also comprises a document name, converting the document name into a script name of the Jmeter test script;
further, if the interface document further includes an interface environment, converting the interface environment into "http sample/domain" and "http sample/port" in the Jmeter test script;
further, if the interface document further includes an interface description, the interface description is converted into a "response assertion" in the Jmeter script;
s304, executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script.
As can be seen from the above-mentioned practical embodiment, the automatic interface testing method provided by the present invention obtains the attribute information of the interface after receiving the interface testing instruction; correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface; converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts; and executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script. The efficiency and the accuracy of interface test can be improved, and the labor cost is saved.
In addition, the invention also provides a computer readable storage medium, wherein the computer readable storage medium stores an interface automation test program, and the interface automation test program realizes the following operations when being executed by a processor:
after receiving an interface test instruction, acquiring attribute information of the interface;
correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
and executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script.
The implementation process of the computer readable storage medium of the present invention is similar to the implementation process of the above-mentioned electronic device and the method for deleting pictures based on the mixed dish binary code, and will not be repeated here.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention. The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (8)

1. An electronic device comprising a memory and a processor coupled to the memory, the processor configured to execute an interface automation test program stored on the memory, the interface automation test program when executed by the processor performing the steps of:
a1, after receiving an interface test instruction, acquiring attribute information of the interface;
a2, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
a3, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
a4, executing the Jmeter test script and generating a test report based on the execution result of the Jmeter test script;
wherein, in the step A3, the conversion rule corresponding to the predetermined interface document and the test script is: a. converting the interface names contained in the interface document into test case names of target test scripts; each interface name corresponds to a test case name; b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script; c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script; d. converting the request parameters in the interface document into an 'image value' in the Jmeter script; e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
2. The electronic device according to claim 1, wherein in the step A1, the step of acquiring attribute information of the interface includes:
acquiring interface data corresponding to the interface;
and analyzing the interface data to analyze attribute information of the interface.
3. The electronic device according to claim 1, wherein in the step A2, the pre-stored interface document template is an EXCEL document in which an interface attribute information addition frame is provided; the step A2 comprises the following steps:
and correspondingly adding the attribute information of the interface to an adding frame arranged in the EXCEL document, and generating an interface document of the interface.
4. An electronic device according to any one of claims 1-3, wherein in step A1, the attribute information of the interface includes: interface name, uniform resource locator, request parameter, request mode and output parameter.
5. An automated interface testing method, comprising the steps of:
s1, after receiving an interface test instruction, acquiring attribute information of an interface;
s2, correspondingly adding the attribute information of the interface into a pre-stored interface document template to generate an interface document of the interface;
s3, converting interface parameters in the interface document into corresponding Jmeter test scripts according to a conversion rule corresponding to the predetermined interface document and the test scripts;
s4, executing the Jmeter test script and generating a test report based on an execution result of the Jmeter test script;
wherein, in the step S3, the conversion rule corresponding to the predetermined interface document and the test script is: a. converting the interface names contained in the interface document into test case names of target test scripts; each interface name corresponds to a test case name; b. converting a uniform resource locator (interface URL) in the interface document into an HTTPSampler.path' in the Jmeter script; c. converting the request mode in the interface document into an HTTPSampler.method in the JMter script; d. converting the request parameters in the interface document into an 'image value' in the Jmeter script; e. and converting the output parameters in the interface document into key judgment values in a response event in the Jmeter script.
6. The method for automated testing an interface according to claim 5, wherein in the step S1, the step of acquiring attribute information of the interface includes:
acquiring interface data corresponding to the interface;
and analyzing the interface data to analyze attribute information of the interface.
7. The automated interface testing method according to claim 5, wherein in the step S2, the pre-stored interface document template is an EXCEL document, and an interface attribute information adding frame is provided in the EXCEL document; the step S2 includes:
and correspondingly adding the attribute information of the interface to an adding frame arranged in the EXCEL document, and generating an interface document of the interface.
8. A computer readable storage medium storing an interface automation test program executable by at least one processor to cause the at least one processor to perform the steps of the interface automation test method of any of claims 5-7.
CN201811256478.5A 2018-10-26 2018-10-26 Electronic device, interface automatic test method and storage medium Active CN109634841B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811256478.5A CN109634841B (en) 2018-10-26 2018-10-26 Electronic device, interface automatic test method and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811256478.5A CN109634841B (en) 2018-10-26 2018-10-26 Electronic device, interface automatic test method and storage medium

Publications (2)

Publication Number Publication Date
CN109634841A CN109634841A (en) 2019-04-16
CN109634841B true CN109634841B (en) 2024-03-12

Family

ID=66066753

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811256478.5A Active CN109634841B (en) 2018-10-26 2018-10-26 Electronic device, interface automatic test method and storage medium

Country Status (1)

Country Link
CN (1) CN109634841B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162465A (en) * 2019-04-19 2019-08-23 平安普惠企业管理有限公司 A kind of banking software system test method, device, electronic equipment and storage medium
CN110175129A (en) * 2019-05-30 2019-08-27 立讯精密工业股份有限公司 Test method and test macro
CN110688315A (en) * 2019-09-26 2020-01-14 招商局金融科技有限公司 Interface code detection report generation method, electronic device, and storage medium
CN110955600B (en) * 2019-11-27 2023-11-10 中国银行股份有限公司 Interface testing method and device
CN112416742A (en) * 2019-12-27 2021-02-26 上海哔哩哔哩科技有限公司 Automatic generation method of JMeter test script, interface test method and system
CN111694749A (en) * 2020-06-24 2020-09-22 深圳壹账通智能科技有限公司 Automatic interface testing method and device, computer equipment and readable storage medium
CN112527646A (en) * 2020-12-15 2021-03-19 北京指掌易科技有限公司 Method and device for improving API (application program interface) automation test efficiency and electronic equipment
CN113485922A (en) * 2021-06-30 2021-10-08 山东有人物联网股份有限公司 Test case generation method, test method, tool, device and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636254A (en) * 2015-01-16 2015-05-20 北京创毅视讯科技有限公司 Method and device for generating test case, testing method and testing equipment
CN107608889A (en) * 2017-09-15 2018-01-19 杭州销冠网络科技有限公司 A kind of test script automatic generation method and system
CN107729243A (en) * 2017-10-12 2018-02-23 上海携程金融信息服务有限公司 API automated testing method, system, equipment and storage medium
CN107894952A (en) * 2017-11-08 2018-04-10 中国平安人寿保险股份有限公司 Generation method, device, equipment and the readable storage medium storing program for executing of interface testing use-case
CN107908541A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Interface test method, device, computer equipment and storage medium
CN108415832A (en) * 2018-02-07 2018-08-17 平安科技(深圳)有限公司 Automatic interface testing method, device, equipment and storage medium
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9507698B2 (en) * 2012-06-06 2016-11-29 Oracle International Corporation Test code generation based on test documentation
US10409712B2 (en) * 2016-12-30 2019-09-10 Accenture Global Solutions Limited Device based visual test automation

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636254A (en) * 2015-01-16 2015-05-20 北京创毅视讯科技有限公司 Method and device for generating test case, testing method and testing equipment
CN107908541A (en) * 2017-07-26 2018-04-13 平安壹钱包电子商务有限公司 Interface test method, device, computer equipment and storage medium
CN107608889A (en) * 2017-09-15 2018-01-19 杭州销冠网络科技有限公司 A kind of test script automatic generation method and system
CN107729243A (en) * 2017-10-12 2018-02-23 上海携程金融信息服务有限公司 API automated testing method, system, equipment and storage medium
CN107894952A (en) * 2017-11-08 2018-04-10 中国平安人寿保险股份有限公司 Generation method, device, equipment and the readable storage medium storing program for executing of interface testing use-case
CN108415832A (en) * 2018-02-07 2018-08-17 平安科技(深圳)有限公司 Automatic interface testing method, device, equipment and storage medium
CN108415847A (en) * 2018-05-08 2018-08-17 平安普惠企业管理有限公司 Performance test methods, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
.Net框架下测试脚本自动生成技术研究;芦彩林;丁刚毅;;微计算机应用;20080515(05);103-106 *

Also Published As

Publication number Publication date
CN109634841A (en) 2019-04-16

Similar Documents

Publication Publication Date Title
CN109634841B (en) Electronic device, interface automatic test method and storage medium
CN109558290B (en) Server, interface automatic test method and storage medium
CN111274760B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN111428462B (en) Communication protocol template construction method and terminal equipment
CN111639287A (en) Page processing method and device, terminal equipment and readable storage medium
CN111290806B (en) Calling method and device of application program interface, computer equipment and storage medium
CN108255513B (en) Electronic device, springmvc-based data interface, automatic generation method of description of springmvc-based data interface, and storage medium
CN109857506B (en) Method and device for realizing guide information, electronic equipment and storage medium
CN112684968A (en) Page display method and device, electronic equipment and computer readable medium
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN110688315A (en) Interface code detection report generation method, electronic device, and storage medium
CN110389899A (en) Detect square law device, medium and the equipment of the API data type of JS program
CN109683856B (en) Electronic device, faas platform function creation method and storage medium
CN118132597A (en) SQL grammar conversion method and device, storage medium and electronic equipment
CN117407048A (en) Flow configuration method and system of plug-in data processing software
CN110443062B (en) Operation method and device of multi-tenant database and computer equipment
CN109815455B (en) Project file processing method and device
CN111078529A (en) Client write-in module testing method and device and electronic equipment
CN115904317A (en) Method, device, equipment and storage medium for uniformly calling front-end interface and back-end interface
CN111026466A (en) File processing method and device, computer readable storage medium and electronic equipment
CN114371866A (en) Version reconfiguration test method, device and equipment of service system
CN112306723A (en) Operation information acquisition method and device applied to small program
CN113377674B (en) Log code adding method and device
CN116266154A (en) Event bus monitoring method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant