[go: up one dir, main page]

CN109634841A - Electronic device, automatic interface testing method and storage medium - Google Patents

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

Info

Publication number
CN109634841A
CN109634841A CN201811256478.5A CN201811256478A CN109634841A CN 109634841 A CN109634841 A CN 109634841A CN 201811256478 A CN201811256478 A CN 201811256478A CN 109634841 A CN109634841 A CN 109634841A
Authority
CN
China
Prior art keywords
interface
document
jmeter
script
converted
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.)
Granted
Application number
CN201811256478.5A
Other languages
Chinese (zh)
Other versions
CN109634841B (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/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • 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 present invention relates to test cases, propose a kind of automatic interface testing method, comprising: after receiving interface testing instruction, obtain the attribute information of the interface;The attribute information correspondence of the interface is added in pre-stored interface document template, the interface document of the interface is generated;According to transformation rule corresponding between predetermined interface document and test script, corresponding Jmeter test script is converted by the interface parameters in the interface document;It executes the Jmeter test script and test report is generated based on the implementing result of the Jmeter test script.It can be improved the efficiency and accuracy of interface testing, save human cost.The present invention also proposes a kind of electronic device and storage medium.

Description

Electronic device, automatic interface testing method and storage medium
Technical field
The present invention relates to interface automatic test field more particularly to a kind of electronic devices, automatic interface testing method And storage medium.
Background technique
During interface testing, it usually needs write test script according to interface document.Interface document is for retouching The attribute of interface is stated, such as format of input parameter, the format of output parameter or communication protocol for describing interface etc..In general, During one interface exploitation, developer can write a interface document corresponding with interface, so as to other developer's energy Corresponding interface is enough well understood by interface document.Currently, since interface and interface document are separately write, and interface Document writes ununified prescribed form, causes in interface test process, needs to carry out continuous ditch with developer The interface testing script that can accurately execute can just be write out to understand the corresponding interface attributes of interface document by leading to, and whole process is not A large amount of manpower is only expended, and will appear interface document and the inconsistent phenomenon of interface attributes, causes testing efficiency low and easy There are test errors.
Summary of the invention
In view of this, the present invention proposes a kind of electronic device, automatic interface testing method and storage medium, can be improved The efficiency and accuracy of interface testing save human cost.
Firstly, to achieve the above object, the present invention proposes a kind of electronic device, the electronic device include memory and The processor connecting with the memory, the processor is for executing the interface automatic test journey stored on the memory Sequence, the interface automatic test program realize following steps when being executed by the processor:
A1, after receiving interface testing instruction, the attribute information of the interface is obtained;
A2, the attribute information correspondence of the interface is added in pre-stored interface document template, is connect described in generation The interface document of mouth;
A3, according to transformation rule corresponding between predetermined interface document and test script, by the interface document In interface parameters be converted into corresponding Jmeter test script;
A4 executes the Jmeter test script and generates test report based on the implementing result of the Jmeter test script It accuses.
Preferably, in the step A1, it is described obtain the interface attribute information the step of, comprising:
Obtain the corresponding interface data of the interface;
The interface data is parsed, to parse the attribute information of the interface.
Preferably, in the step A2, the pre-stored interface document template is EXCEL document, the EXCEL Interface attributes information addition frame is provided in document;The step A2 includes:
The attribute information correspondence of the interface is added to the addition frame being arranged in the EXCEL document, is connect described in generation The interface document of mouth.
Preferably, corresponding between the predetermined interface document and Jmeter test script in the step A3 Transformation rule are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script; Specifically, each interface name respectively corresponds a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C. the request method in the interface document is converted in the Jmeter script "HTTPSampler.method";
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in the Jmeter script Crucial judgment value in " ResponseAssertion ".
Preferably, in the step A1, the attribute information of the interface include: interface name, uniform resource locator, Required parameter, request method, output parameter.
In addition, to achieve the goals above, the present invention also proposes a kind of automatic interface testing method, the method includes Following steps:
S1, after receiving interface testing instruction, the attribute information of the interface is obtained;
S2, the attribute information correspondence of the interface is added in pre-stored interface document template, is connect described in generation The interface document of mouth;
S3, according to transformation rule corresponding between predetermined interface document and test script, by the interface document In interface parameters be converted into corresponding Jmeter test script;
S4, it executes the Jmeter test script and test report is generated based on the implementing result of the Jmeter test script It accuses.
Preferably, in the step S1, the step of attribute information for obtaining the interface, comprising:
Obtain the corresponding interface data of the interface;
The interface data is parsed, to parse the attribute information of the interface.
Preferably, in the step S2, the pre-stored interface document template is EXCEL document, the EXCEL Interface attributes information addition frame is provided in document;The step A2 includes:
The attribute information correspondence of the interface is added to the addition frame being arranged in the EXCEL document, is connect described in generation The interface document of mouth.
Preferably, in the step S3, corresponding between the predetermined interface document and Jmeter test script Transformation rule are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script; Specifically, each interface name respectively corresponds a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C. the request method in the interface document is converted in the Jmeter script "HTTPSampler.method";
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in the Jmeter script Crucial judgment value in " ResponseAssertion ".
In addition, to achieve the above object, the present invention also proposes a kind of computer readable storage medium, described computer-readable Storage medium is stored with interface automatic test program, and the interface automatic test program can be held by least one processor Row, so that the step of at least one described processor executes automatic interface testing method as described above.
Electronic device, automatic interface testing method and storage medium proposed by the invention is surveyed by receiving interface After examination instruction, the attribute information of the interface is obtained;The attribute information of the interface is corresponded to and is added to pre-stored interface text In shelves template, the interface document of the interface is generated;According to corresponding turn between predetermined interface document and test script Change rule, converts corresponding Jmeter test script for the interface parameters in the interface document;The Jmeter is executed to survey Training sheet simultaneously generates test report based on the implementing result of the Jmeter test script.Can be improved interface testing efficiency and Accuracy saves human cost.
Detailed description of the invention
Fig. 1 is the schematic diagram of the optional hardware structure of electronic device one proposed by the present invention;
Fig. 2 is the program module schematic diagram of interface automatic test in one embodiment of electronic device of the present invention;
Fig. 3 is the implementation flow chart of automatic interface testing method preferred embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work Every other embodiment obtained is put, shall fall within the protection scope of the present invention.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims Protection scope within.
As shown in fig.1, being the optional hardware structure schematic diagram of electronic device one proposed by the present invention.In the present embodiment, Electronic device 10 may include, but be not limited only to, and connection memory 11, processor 12, net can be in communication with each other by communication bus 14 Network interface 13.It should be pointed out that Fig. 1 illustrates only the electronic device 10 with component 11-14, it should be understood that simultaneously All components shown realistic are not applied, the implementation that can be substituted is more or less component.
Wherein, memory 11 includes at least a type of computer readable storage medium, computer readable storage medium Including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory etc.), random access storage device (RAM), quiet State random access storage device (SRAM), electrically erasable programmable read-only memory (EEPROM), can be compiled read-only memory (ROM) Journey read-only memory (PROM), magnetic storage, disk, CD etc..In some embodiments, memory 11 can be electronics dress Set 10 internal storage unit, such as the hard disk or memory of electronic device 10.In further embodiments, memory 11 can also be with It is the outer packet storage device of electronic device 10, such as the plug-in type hard disk being equipped on electronic device 10, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Certainly, it stores Device 11 can also both including electronic device 10 internal storage unit and also including its outer packet storage device.In the present embodiment, storage Device 11 is installed on the operating system and types of applications software of electronic device 10, such as interface automatic test journey commonly used in storage Sequence etc..In addition, memory 11 can be also used for temporarily storing the Various types of data that has exported or will export.
Processor 12 can be in some embodiments central processing unit (Central Processing Unit, CPU), Controller, microcontroller, microprocessor or other data processing chips.Processor 12 is commonly used in control electronic device 10 Overall operation.In the present embodiment, program code or processing data of the processor 12 for being stored in run memory 11, such as Interface automatic test program of operation etc..
Network interface 13 may include radio network interface or wired network interface, and network interface 13 is commonly used in filling in electronics It sets and establishes communication connection between 10 and other electronic equipments.
Communication bus 14 is for realizing the communication connection between component 11-13.
Fig. 1 illustrates only the electronic device 10 with component 11-14 and interface automatic test, it should be understood that It is, it is not required that implement all components shown, the implementation that can be substituted is more or less component.
Optionally, electronic device 10 can also include user interface (not shown in figure 1), and user interface may include display Device, input unit such as keyboard, wherein user interface can also be including standard wireline interface and wireless interface etc..
Optionally, in some embodiments, display can be light-emitting diode display, liquid crystal display, touch control type LCD and show Device and OLED touch device etc..Further, display is alternatively referred to as display screen or display unit, for being shown in electronic device Information is handled in 10 and for showing visual user interface.
Optionally, in some embodiments, electronic device 10 can also include that audio unit (does not show in audio unit Fig. 1 Out), audio unit can be in call signal reception pattern, call mode, logging mode, speech recognition mould in electronic device 10 When under the isotypes such as formula, broadcast reception mode, received or storage audio data is converted into audio signal;Further Ground, electronic device 10 can also include audio output unit, and the audio signal that audio output unit converts audio unit exports, And audio output unit can also provide the relevant audio output of specific function that executes to electronic device 10 (such as calling is believed Number receive sound, message sink sound etc.), audio output unit may include loudspeaker, buzzer etc..
Optionally, in some embodiments, electronic device 10 can also include alarm unit (not shown), alarm list Member can provide output and the generation of event is notified electron device 10.Typical event may include calling reception, message Reception, key signals input, touch input etc..Other than audio or video export, alarm unit can be with different sides Formula provides output with the generation of notification event.For example, alarm unit can provide output in the form of vibration, exhaled when receiving Cry, message or it is some other can make electronic device 10 enter communication pattern when, alarm unit can provide tactile output (that is, Vibration) to notify to user.
In one embodiment, it when the interface automatic test program stored in memory 11 is executed by processor 12, realizes Following operation:
A1 obtains the attribute information of the interface after receiving interface testing instruction;
Specifically, in the present embodiment, the interface can be any application programming interface for having developed completion (Application Programming Interface, API), the phase between same system different function layer may be implemented in API Mutual communication.In general, developer can develop the various interfaces for realizing different function according to actual needs.It is understood that It is that developer can explain interface routine accordingly at development interface (writing interface routine), to be subsequent Corresponding interface document is generated according to the interface routine explained, and basis is provided.In the present embodiment, interface routine is infused Solution, which is specifically included, to be labeled and explains to the attribute information of interface.The attribute information of interface includes but is not limited to the name of interface The required parameter of title, the uniform resource locator (Unif o rm Resource Locator, URL) of interface, interface (RequestBody), the request method of interface, interface output parameter etc..
Specifically, the step of attribute information for obtaining the interface includes: to obtain the corresponding interface data of the interface; The interface data is parsed, to parse the attribute information of the interface.It is understood that developer is in interface In development process, interface routine can be explained according to preset note mode.Wherein, preset note mode can root It is arranged according to actual demand, herein with no restrictions.For example, preset note mode can be explained for Hibernate Validator Tool, alternatively, preset note mode can be the customized note mode of developer.In embodiments of the present invention, interface Data are generated according to the interface routine explained, and interface data is used to describe the attribute information of interface, and interface data is default The data of format.Preset format can be arranged according to actual needs, herein with no restrictions.For example, preset format can be Java Scripting object marks (JavaScript Object Notation, JSON) format, and JSON format is the text data of lightweight Exchange format describes data object using java script grammer, is more readily understood.It is possible to further first pass through JSON in advance The interface routine explained is converted to the interface data of corresponding JSON format by resolver, and by the corresponding interface data of interface It stores to local.After receiving interface testing instruction, the corresponding interface data of the interface can be obtained from local;To described Interface data is parsed, to parse the attribute information of the interface.Specifically, according to corresponding with the format of interface data Analysis mode parses interface data.For example, can be parsed using JSON if interface data is the data of JSON format Device parses interface data, and the attribute information of the interface is obtained after parsing to interface data.
A2, the attribute information correspondence of the interface is added in pre-stored interface document template, is connect described in generation The interface document of mouth;
Specifically, in the present embodiment, the pre-stored interface document template can be arranged according to actual needs, this Place is with no restrictions.For example, the pre-stored interface document template can be EXCEL document, it is arranged in the EXCEL document There are the interface attributes such as interface name, interface environment, interface URL, interface requests mode, interface requests parameter, interface output parameter Information adds frame, and the attribute information of the interface is corresponded to and is added to the addition frame being arranged in the EXCEL document, described in generation The interface document of interface.
A3, according to transformation rule corresponding between predetermined interface document and Jmeter test script, connect described Interface parameters in mouth document is converted into corresponding Jmeter test script;
Specifically, corresponding transformation rule between the predetermined interface document and Jmeter test script are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script; Specifically, each interface name respectively corresponds a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C. the request method in the interface document is converted in the Jmeter script "HTTPSampler.method";
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in the Jmeter script Crucial judgment value in " ResponseAssertion ".
Further, if the interface document further includes general preamble section, the general preamble section in the interface document is turned Turn to the common portion of the Jmeter test script;Such as:
A.testclass=" CookieManager " testname=" HTTP Cookie manager ";
B.testclass=" HeaderManager " testname=" HTTP information header manager ";
C.testclass=" LoopController " testname=" HTTP request default value ";
Further, it if further including document title in the interface document, converts the document title to described The script name of Jmeter test script;
Further, if further including interface environment in the interface document, the interface environment is converted to described " HTTPSampler.domain " in Jmeter test script, " HTTPSampler.port ";
Further, if the interface document further includes interface specification, the interface specification is converted to the Jmeter " ResponseAssertion " in script;
A4, it executes the Jmeter test script and test report is generated based on the implementing result of the Jmeter test script It accuses.
By above-mentioned thing embodiment it is found that electronic device proposed by the present invention is obtained after receiving interface testing instruction The attribute information of the interface;The attribute information correspondence of the interface is added in pre-stored interface document template, is generated The interface document of the interface;It, will be described according to transformation rule corresponding between predetermined interface document and test script Interface parameters in interface document is converted into corresponding Jmeter test script;Execute the Jmeter test script and based on institute The implementing result for stating Jmeter test script generates test report.It can be improved the efficiency and accuracy of interface testing, save people Power cost.
In addition, interface automatic test of the invention is different according to the function that its each section is realized, it can be identical with having The program module of function is described.It please refers to shown in Fig. 2, is interface automatic test in one embodiment of electronic device of the present invention Program module schematic diagram.In the present embodiment, the difference for the function that interface automatic test is realized according to its each section can be with It is divided into and obtains module 201, adding module 202, conversion module 203 and execution module 204.By above description it is found that The so-called program module of the present invention is the series of computation machine program instruction section for referring to complete specific function, is more suitable for than program In implementation procedure of the description interface automatic test program in electronic device 10.The function that the module 201-204 is realized Or operating procedure is similar as above, and will not be described here in detail, illustratively, such as wherein:
After module 201 is obtained for receiving interface testing instruction, the attribute information of the interface is obtained;
Adding module 202 is used to the attribute information correspondence of the interface being added to pre-stored interface document template In, generate the interface document of the interface;
Conversion module 203 is used for according to transformation rule corresponding between predetermined interface document and test script, will Interface parameters in the interface document is converted into corresponding Jmeter test script;
Execution module 204 is for executing the Jmeter test script and the execution knot based on the Jmeter test script Fruit generates test report.
In addition, the present invention also proposes a kind of automatic interface testing method, please refer to shown in Fig. 3, the interface automation Test method includes the following steps:
S301 obtains the attribute information of the interface after receiving interface testing instruction;
Specifically, in the present embodiment, the interface can be any application programming interface for having developed completion (Application Programming Interface, API), the phase between same system different function layer may be implemented in API Mutual communication.In general, developer can develop the various interfaces for realizing different function according to actual needs.It is understood that It is that developer can explain interface routine accordingly at development interface (writing interface routine), to be subsequent Corresponding interface document is generated according to the interface routine explained, and basis is provided.In the present embodiment, interface routine is infused Solution, which is specifically included, to be labeled and explains to the attribute information of interface.The attribute information of interface includes but is not limited to the name of interface The required parameter of title, the uniform resource locator (Unif o rm Resource Locator, URL) of interface, interface (RequestBody), the request method of interface, interface output parameter etc..
Specifically, the step of attribute information for obtaining the interface includes: to obtain the corresponding interface data of the interface; The interface data is parsed, to parse the attribute information of the interface.It is understood that developer is in interface In development process, interface routine can be explained according to preset note mode.Wherein, preset note mode can root It is arranged according to actual demand, herein with no restrictions.For example, preset note mode can be explained for Hibernate Validator Tool, alternatively, preset note mode can be the customized note mode of developer.In embodiments of the present invention, interface Data are generated according to the interface routine explained, and interface data is used to describe the attribute information of interface, and interface data is default The data of format.Preset format can be arranged according to actual needs, herein with no restrictions.For example, preset format can be Java Scripting object marks (JavaScript Object Notation, JSON) format, and JSON format is the text data of lightweight Exchange format describes data object using java script grammer, is more readily understood.It is possible to further first pass through JSON in advance The interface routine explained is converted to the interface data of corresponding JSON format by resolver, and by the corresponding interface data of interface It stores to local.After receiving interface testing instruction, the corresponding interface data of the interface can be obtained from local;To described Interface data is parsed, to parse the attribute information of the interface.Specifically, according to corresponding with the format of interface data Analysis mode parses interface data.For example, can be parsed using JSON if interface data is the data of JSON format Device parses interface data, and the attribute information of the interface is obtained after parsing to interface data.
S302, the attribute information correspondence of the interface is added in pre-stored interface document template, described in generation The interface document of interface;
Specifically, in the present embodiment, the pre-stored interface document template can be arranged according to actual needs, this Place is with no restrictions.For example, the pre-stored interface document template can be EXCEL document, it is arranged in the EXCEL document There are the interface attributes such as interface name, interface environment, interface URL, interface requests mode, interface requests parameter, interface output parameter Information adds frame, and the attribute information of the interface is corresponded to and is added to the addition frame being arranged in the EXCEL document, described in generation The interface document of interface.
S303, according to transformation rule corresponding between predetermined interface document and Jmeter test script, will be described Interface parameters in interface document is converted into corresponding Jmeter test script;
Specifically, corresponding transformation rule between the predetermined interface document and Jmeter test script are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script; Specifically, each interface name respectively corresponds a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C. the request method in the interface document is converted in the Jmeter script "HTTPSampler.method";
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in the Jmeter script Crucial judgment value in " ResponseAssertion ".
Further, if the interface document further includes general preamble section, the general preamble section in the interface document is turned Turn to the common portion of the Jmeter test script;Such as:
A.testclass=" CookieManager " testname=" HTTP Cookie manager ";
B.testclass=" HeaderManager " testname=" HTTP information header manager ";
C.testclass=" LoopController " testname=" HTTP request default value ";
Further, it if further including document title in the interface document, converts the document title to described The script name of Jmeter test script;
Further, if further including interface environment in the interface document, the interface environment is converted to described " HTTPSampler.domain " in Jmeter test script, " HTTPSampler.port ";
Further, if the interface document further includes interface specification, the interface specification is converted to the Jmeter " ResponseAssertion " in script;
S304, it executes the Jmeter test script and is generated based on the implementing result of the Jmeter test script and tested Report.
By above-mentioned thing embodiment it is found that automatic interface testing method proposed by the present invention, by receiving interface testing After instruction, the attribute information of the interface is obtained;The attribute information correspondence of the interface is added to pre-stored interface document In template, the interface document of the interface is generated;According to conversion corresponding between predetermined interface document and test script The interface parameters in the interface document is converted corresponding Jmeter test script by rule;Execute the Jmeter test Script simultaneously generates test report based on the implementing result of the Jmeter test script.It can be improved the efficiency and standard of interface testing True property saves human cost.
In addition, the present invention also proposes a kind of computer readable storage medium, stored on the computer readable storage medium There is interface automatic test program, following operation realized when the interface automatic test program is executed by processor:
After receiving interface testing instruction, the attribute information of the interface is obtained;
The attribute information correspondence of the interface is added in pre-stored interface document template, the interface is generated Interface document;
It, will be in the interface document according to transformation rule corresponding between predetermined interface document and test script Interface parameters is converted into corresponding Jmeter test script;
It executes the Jmeter test script and test report is generated based on the implementing result of the Jmeter test script.
The specific implementation process of computer readable storage medium of the present invention, with above-mentioned electronic device and based on mixed meat and fish dishes two into The specific implementation process of the image deletion method of code processed is similar, and details are not described herein.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, computer, clothes Business device, air conditioner or the network equipment etc.) execute method described in each embodiment of the present invention.The above is only of the invention excellent Embodiment is selected, is not intended to limit the scope of the invention, it is all using made by description of the invention and accompanying drawing content etc. Structure or equivalent process transformation are imitated, is applied directly or indirectly in other relevant technical fields, and is similarly included in the present invention Scope of patent protection in.

Claims (10)

1. a kind of electronic device, which is characterized in that the electronic device includes memory and the processing that connect with the memory Device, the processor is for executing the interface automatic test program stored on the memory, the interface automatic test Program realizes following steps when being executed by the processor:
A1, after receiving interface testing instruction, the attribute information of the interface is obtained;
A2, the attribute information correspondence of the interface is added in pre-stored interface document template, generates the interface Interface document;
A3, according to transformation rule corresponding between predetermined interface document and test script, will be in the interface document Interface parameters is converted into corresponding Jmeter test script;
A4 executes the Jmeter test script and generates test report based on the implementing result of the Jmeter test script.
2. electronic device as described in claim 1, which is characterized in that in the step A1, the category for obtaining the interface The step of property information, comprising:
Obtain the corresponding interface data of the interface;
The interface data is parsed, to parse the attribute information of the interface.
3. electronic device as described in claim 1, which is characterized in that in the step A2, the pre-stored interface Document template is EXCEL document, and interface attributes information addition frame is provided in the EXCEL document;The step A2 includes:
The attribute information correspondence of the interface is added to the addition frame being arranged in the EXCEL document, generates the interface Interface document.
4. electronic device as described in claim 1, which is characterized in that in the step A3, the predetermined interface Corresponding transformation rule between document and Jmeter test script are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script;Specifically Ground, each interface name respectively correspond a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C., request method in the interface document is converted to " HTTPSampler.method " in the Jmeter script;
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in " ResponseAssertion " in the Jmeter script Crucial judgment value.
5. the electronic device as described in claim 1-4 is any, which is characterized in that in the step A1, the category of the interface Property information includes: interface name, uniform resource locator, required parameter, request method, output parameter.
6. a kind of automatic interface testing method, which is characterized in that described method includes following steps:
S1, after receiving interface testing instruction, the attribute information of the interface is obtained;
S2, the attribute information correspondence of the interface is added in pre-stored interface document template, generates the interface Interface document;
S3, according to transformation rule corresponding between predetermined interface document and test script, will be in the interface document Interface parameters is converted into corresponding Jmeter test script;
S4, it executes the Jmeter test script and test report is generated based on the implementing result of the Jmeter test script.
7. automatic interface testing method as claimed in claim 6, which is characterized in that in the step S1, the acquisition The step of attribute information of the interface, comprising:
Obtain the corresponding interface data of the interface;
The interface data is parsed, to parse the attribute information of the interface.
8. automatic interface testing method as claimed in claim 7, which is characterized in that described preparatory in the step S2 The interface document template of storage is EXCEL document, and interface attributes information addition frame is provided in the EXCEL document;The step Suddenly A2 includes:
The attribute information correspondence of the interface is added to the addition frame being arranged in the EXCEL document, generates the interface Interface document.
9. automatic interface testing method as claimed in claim 6, which is characterized in that in the step S3, described preparatory Corresponding transformation rule between determining interface document and Jmeter test script are as follows:
A., the interface name for including in the interface document is converted to the test cases title of the target detection script;Specifically Ground, each interface name respectively correspond a test cases title;
B. the uniform resource locator (interface URL) in the interface document is converted in the Jmeter script "HTTPSampler.path";
C., request method in the interface document is converted to " HTTPSampler.method " in the Jmeter script;
D., required parameter in the interface document is converted to " Argument.value " in the Jmeter script;
E. the output parameter in the interface document is converted in " ResponseAssertion " in the Jmeter script Crucial judgment value.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has interface automatic test program, The interface automatic test program can be executed by least one processor, so that at least one described processor executes such as right It is required that the step of automatic interface testing method described in any one of 6-9.
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 true CN109634841A (en) 2019-04-16
CN109634841B 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)

Cited By (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
CN110955600A (en) * 2019-11-27 2020-04-03 中国银行股份有限公司 Interface test method and device
CN111694749A (en) * 2020-06-24 2020-09-22 深圳壹账通智能科技有限公司 Automatic interface testing method and device, computer equipment and readable storage medium
CN112416742A (en) * 2019-12-27 2021-02-26 上海哔哩哔哩科技有限公司 Automatic generation method of JMeter test script, interface test method and system
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 (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130332905A1 (en) * 2012-06-06 2013-12-12 Oracle International Corporation Test code generation based on test documentation
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
US20180189170A1 (en) * 2016-12-30 2018-07-05 Accenture Global Solutions Limited Device-based visual test automation
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

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130332905A1 (en) * 2012-06-06 2013-12-12 Oracle International Corporation Test code generation based on test documentation
CN104636254A (en) * 2015-01-16 2015-05-20 北京创毅视讯科技有限公司 Method and device for generating test case, testing method and testing equipment
US20180189170A1 (en) * 2016-12-30 2018-07-05 Accenture Global Solutions Limited Device-based visual test automation
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框架下测试脚本自动生成技术研究", 微计算机应用, no. 05, 15 May 2008 (2008-05-15), pages 103 - 106 *

Cited By (9)

* 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
CN110955600A (en) * 2019-11-27 2020-04-03 中国银行股份有限公司 Interface test method and device
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

Also Published As

Publication number Publication date
CN109634841B (en) 2024-03-12

Similar Documents

Publication Publication Date Title
CN109634841A (en) Electronic device, automatic interface testing method and storage medium
CN109558290A (en) Server, automatic interface testing method and storage medium
CN110058999A (en) Electronic device, application exception localization method and storage medium
CN104794396B (en) Across standing posture script loophole detection method and device
CN113672441B (en) Method and device for testing intelligent equipment
CN107122301A (en) Interface detection method and device
CN109857506B (en) Method and device for realizing guide information, electronic equipment and storage medium
CN107861713A (en) Data calling method, device and computer-readable recording medium
CN104598513A (en) Data flow control method and system based on webpage frame
CN110069177A (en) Electronic device, application program guiding method of operating and storage medium
KR20160058673A (en) Method and apparatus for preventing injection-type attacks in a web based operating system
CN109284198A (en) A kind of method and apparatus verifying data
CN109684195A (en) Electronic device, script conversion method and storage medium
CN110287093A (en) Mobile terminal, data interface test method and storage medium
CN110163481A (en) Electronic device, user's air control auditing system test method and storage medium
CN105871911A (en) Service calling engine, method and system
CN108924030A (en) Electronic device, the method for dynamically configuration message exhibition method and storage medium
US8438577B2 (en) Method and system for extending scripting languages
CN109522307A (en) Server, the declaration form data query method based on Mongodb and storage medium
CN114282760B (en) A workflow generation method and device combining dynamic form and dynamic process
CN109683856A (en) Electronic device, Faas stage function creation method and storage medium
CN107291211A (en) The electric quantity consumption of application program determines method and device
CN106790380A (en) Data reporting method and device
CN110191013A (en) Electronic device, the Mock test method of more capital's interfaces and storage medium
CN109634806A (en) Electronic device, server cluster monitoring method and storage medium

Legal Events

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