CN107766242A - A kind of interface test method based on JMETER - Google Patents
A kind of interface test method based on JMETER Download PDFInfo
- Publication number
- CN107766242A CN107766242A CN201710928238.4A CN201710928238A CN107766242A CN 107766242 A CN107766242 A CN 107766242A CN 201710928238 A CN201710928238 A CN 201710928238A CN 107766242 A CN107766242 A CN 107766242A
- Authority
- CN
- China
- Prior art keywords
- jmeter
- interface
- test
- java
- test method
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of interface test method based on JMETER, the interface test method comprises the following steps:S1, using instrument based on JMETER, pass through the service agreement for reflecting and obtaining interface;S2, using Json Template generate list, get parms;S3, pass through reflection execution runTest methods;Use-case is performed after S4, configuration parameter, then checks test result, completes test.Using the interface test method of the disclosure of the invention, when being tested in face of common JAVA interface, by simply setting and changing parameter, can directly it use, tester is not needed to write code, the requirement for test is relatively low, can widely popularize in testing and convenient use.
Description
Technical field
The present invention relates to software testing technology field, and in particular to a kind of interface test method based on JMETER.
Background technology
Apache JMETER are the pressure test instruments based on JAVA of Apache organization developments, be can be used for static state
And dynamic resource (file, Servlet, perl script, JAVA object, database and inquiry, ftp server etc.) property
It can be tested;It can be used for testing their intensity or analysis to server, network or the heavy load of simulating
Overall performance under different pressures type.
It is currently based in the interface testing of JMETER supports, can directly supports http agreements and webservice, still
For common JAVA interface, carried out by the test code of manual compiling software interface.
The content of the invention
The invention aims to solve drawbacks described above of the prior art, there is provided a kind of interface based on JMETER is surveyed
Method for testing, the interface test method are tested for JMETER common JAVA interface, can be direct by setting and changing parameter
Use, it is not necessary to which tester writes code.
The purpose of the present invention can be reached by adopting the following technical scheme that:
A kind of interface test method based on JMETER, described interface test method comprise the following steps:
S1, using instrument based on JMETER, pass through the service agreement for reflecting and obtaining interface;
S2, using Json Template generate list, get parms;
S3, pass through reflection execution runTest methods;
Use-case is performed after S4, configuration parameter, then checks test result, completes test.
Further, use-case is performed after described step S4, configuration parameter, then checks test result, complete test tool
Body includes:
JMETER is opened, establishes a test plan;
JMETER sets of threads is chosen, the JAVA titles under Sampler is found, adds this element;
Edit test case;
Perform use-case;
Click directly on the current test case of operation;
Check test result.
Further, check before test result in described step S4, also comprise the following steps:
Bearing-age tree element is watched in addition one.
Further, described step S1, using instrument based on JMETER, pass through the service agreement for reflecting and obtaining interface
Specifically include:
JMETER and Eclipse environment is installed;
Establish JAVA class files;
Instantiated in Public void setupTest (JavaSamplerContext context)
BeanshellEg classes;
With reference to JMETER JavaTest, AbstractJavaSamplerClient classes are inherited, can be in Java Sampler
See the Java requests of foundation;
JAVA required parameters are carried out by public Arguments getDefaultParameters (), and made
Parameter list fills in variable for user;
Being called using public SampleResult runTest (JavaSamplerContext context) needs to survey
The interface of examination;
SampleResult is instantiated, records operation result;
Things is defined to start;
Things is set to terminate;
Things success is set;
Java Sampler titles are set;
Setting responds successfully;
Response contents are set;
Complete to finish up using public void teardownTest (JavaSamplerContext context);
The class finished writing, be packaged into .JAR files, be placed on JMETER engineerings %JMETER_HOME% lib ext catalogues
In;
The interface bag that needs are tested be put into JMETER engineerings %JMETER_HOME% lib catalogues, dependence bag is put
To JMETER engineerings %JMETER_HOME% in lib catalogues;
JMETER is restarted, the list of class name drop-down can see the class of extension.
The present invention is had the following advantages relative to prior art and effect:
Interface test method provided by the invention based on JMETER, tested for common JAVA interface, by simple
Parameter is set and changed, can directly be used, it is not necessary to which tester writes code.Requirement for test is relatively low, Neng Gou
Widelyd popularize in test and convenient use.
Brief description of the drawings
Fig. 1 is a kind of process step figure of interface test method based on JMETER disclosed by the invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention
In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is
Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art
The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
Embodiment
Common JAVA interface test based on JMETER, tests code to carry out, this method will by manual compiling
Ask tester that there is stronger test code development ability, it is big to test the workload of code development, is unfavorable for software interface survey
The extensive development that trial work is made, and the cost of software interface test is higher.
Present embodiment discloses a kind of interface test method based on JMETER, is connect mainly for JMETER common JAVA
Mouth test, by setting and changing parameter, can directly be used, it is not necessary to which tester writes code.
As shown in Figure 1, the interface test method specifically includes the following steps:
Using instrument based on JMETER, by the service agreement for reflecting acquisition interface;
List is generated using Json Template, is got parms;
RunTest methods are performed by reflecting;
Use-case is performed after setting parameter, then checks test result, so as to complete to test.
It was found from above-mentioned steps, by the grammer of the simple readabilities of Json Template, tester can easily edit mould
Plate file, it is not necessary to write code.
The present invention described further below implements the specific implementation flow of this method provided.
Install the environment such as JMETER, Eclipse;
Establish JAVA class files;
Instantiated in Public void setupTest (JavaSamplerContext context)
BeanshellEg classes;
With reference to JMETER JavaTest, AbstractJavaSamplerClient classes are inherited, can be in Java
Sampler sees the Java requests of foundation;
JAVA required parameters are carried out by public Arguments getDefaultParameters (), and made
Parameter list fills in variable for user;
Being called using public SampleResult runTest (JavaSamplerContext context) needs to survey
The interface of examination;
SampleResult is instantiated, records operation result;
Things is defined to start;
Things is set to terminate;
Things success is set;
Java Sampler titles are set;
Setting responds successfully;
Response contents are set;
Complete to finish up using public void teardownTest (JavaSamplerContext context);
The class finished writing, be packaged into .JAR files, be placed on JMETER engineerings %JMETER_HOME% lib ext catalogues
In;
The interface bag that needs are tested be put into JMETER engineerings %JMETER_HOME% lib catalogues, dependence bag is put
To JMETER engineerings %JMETER_HOME% in lib catalogues;
JMETER is restarted, the list of class name drop-down can see the class of extension.
Perform and configure:
JMETER is opened, establishes a test plan;
Choose JMETER's【Sets of threads】Right button finds the JAVA titles under Sampler, clicks and adds this element;
Edit test case;
Perform use-case;
First add one and watch bearing-age tree element, conveniently check test result;
Click directly on the current test case of operation.
Above-described embodiment is the preferable embodiment of the present invention, but embodiments of the present invention are not by above-described embodiment
Limitation, other any Spirit Essences without departing from the present invention with made under principle change, modification, replacement, combine, simplification,
Equivalent substitute mode is should be, is included within protection scope of the present invention.
Claims (4)
1. a kind of interface test method based on JMETER, it is characterised in that described interface test method comprises the following steps:
S1, using instrument based on JMETER, pass through the service agreement for reflecting and obtaining interface;
S2, using Json Template generate list, get parms;
S3, pass through reflection execution runTest methods;
Use-case is performed after S4, configuration parameter, then checks test result, completes test.
A kind of 2. interface test method based on JMETER according to claim 1, it is characterised in that described step
Use-case is performed after S4, configuration parameter, then checks test result, test is completed and specifically includes:
JMETER is opened, establishes a test plan;
JMETER sets of threads is chosen, the JAVA titles under Sampler is found, adds this element;
Edit test case;
Perform use-case;
Click directly on the current test case of operation;
Check test result.
A kind of 3. interface test method based on JMETER according to claim 2, it is characterised in that described step S4
In check before test result, also comprise the following steps:
Bearing-age tree element is watched in addition one.
A kind of 4. interface test method based on JMETER according to claim 1, it is characterised in that described step
S1, using instrument based on JMETER, the service agreement that interface is obtained by reflecting specifically includes:
JMETER and Eclipse environment is installed;
Establish JAVA class files;
The instantiation BeanshellEg classes in Public void setupTest (JavaSamplerContext context);
With reference to JMETER JavaTest, AbstractJavaSamplerClient classes are inherited, can be seen in Java Sampler
The Java requests of foundation;
JAVA required parameters are carried out by public Arguments getDefaultParameters (), and make parameter
Table fills in variable for user;
Being called using public SampleResult runTest (JavaSamplerContext context) needs what is tested
Interface;
SampleResult is instantiated, records operation result;
Things is defined to start;
Things is set to terminate;
Things success is set;
Java Sampler titles are set;
Setting responds successfully;
Response contents are set;
Complete to finish up using public void teardownTest (JavaSamplerContext context);
The class finished writing, be packaged into .JAR files, be placed on JMETER engineerings %JMETER_HOME% lib in ext catalogues;
The interface bag that needs are tested be put into JMETER engineerings %JMETER_HOME% lib catalogues, dependence bag is put into
The %JMETER_HOME% of JMETER engineerings in lib catalogues;
JMETER is restarted, the list of class name drop-down can see the class of extension.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710928238.4A CN107766242A (en) | 2017-10-09 | 2017-10-09 | A kind of interface test method based on JMETER |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710928238.4A CN107766242A (en) | 2017-10-09 | 2017-10-09 | A kind of interface test method based on JMETER |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107766242A true CN107766242A (en) | 2018-03-06 |
Family
ID=61267105
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710928238.4A Pending CN107766242A (en) | 2017-10-09 | 2017-10-09 | A kind of interface test method based on JMETER |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107766242A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
CN110333897A (en) * | 2019-05-09 | 2019-10-15 | 重庆天蓬网络有限公司 | A kind of interface allocation method, device, medium and electronic equipment |
CN110865892A (en) * | 2019-11-18 | 2020-03-06 | 北京锐安科技有限公司 | Detection method and device for call interface, storage medium and electronic equipment |
CN112329415A (en) * | 2020-10-27 | 2021-02-05 | 江苏华邦网络科技有限公司 | Java web based access and participation processing method and system |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106874188A (en) * | 2016-12-30 | 2017-06-20 | 北京五八信息技术有限公司 | Software interface test approach and device |
-
2017
- 2017-10-09 CN CN201710928238.4A patent/CN107766242A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106874188A (en) * | 2016-12-30 | 2017-06-20 | 北京五八信息技术有限公司 | Software interface test approach and device |
Non-Patent Citations (4)
Title |
---|
ANNIE丁小妞: "JMeter(十七)JMeter测试Java", 《简书:HTTPS://WWW.JIANSHU.COM/P/640E778A865C》 * |
作者不详: "JMeter完成java请求的压力测试", 《程序园:HTTP://VOIDCN.COM/ARTICLE/P-ZJTQVZBI-SM.HTML》 * |
左刚: "基于JUnit框架的接口测试系统研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
徐斌: "《软件工程开源实验指导》", 31 August 2012, 浙江工商大学出版社 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109597761A (en) * | 2018-12-03 | 2019-04-09 | 四川长虹电器股份有限公司 | A kind of automatic interface testing method based on Jmeter |
CN110333897A (en) * | 2019-05-09 | 2019-10-15 | 重庆天蓬网络有限公司 | A kind of interface allocation method, device, medium and electronic equipment |
CN110865892A (en) * | 2019-11-18 | 2020-03-06 | 北京锐安科技有限公司 | Detection method and device for call interface, storage medium and electronic equipment |
CN112329415A (en) * | 2020-10-27 | 2021-02-05 | 江苏华邦网络科技有限公司 | Java web based access and participation processing method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107766242A (en) | A kind of interface test method based on JMETER | |
CN109597761A (en) | A kind of automatic interface testing method based on Jmeter | |
US7243090B2 (en) | System and method for specification tracking in a Java compatibility testing environment | |
CN108287694A (en) | Application builds method, system, computer equipment and storage medium | |
CN108897687A (en) | A kind of API automated testing method and system based on data-driven | |
CN105760286A (en) | Application database dynamic property detection method and detection device | |
CN110750458A (en) | Big data platform testing method and device, readable storage medium and electronic equipment | |
CN105094783A (en) | Method and device for testing Android application stability | |
CN104579822A (en) | Automatic performance test system and method of mobile application based on Http protocol | |
CN107239271A (en) | Develop document structure tree method and device | |
WO2006102123A3 (en) | Apparatus for analysing and organizing artifacts in a software application | |
CN105760296A (en) | Automation testing control method, device and terminal | |
CN103246606A (en) | Method and system for testing performances of ESB (enterprises service bus) platform | |
CN107301041A (en) | A kind of method and system of custom-built system function | |
CN109032929A (en) | Program log record obtaining method and device and electronic equipment | |
Colombo et al. | Verifying web applications: from business level specifications to automated model-based testing | |
de Cleva Farto et al. | Reuse of model-based tests in mobile apps | |
CN108776723B (en) | Test system self-checking adapter connection line generation method, device, equipment and storage medium | |
CN104035872B (en) | Method and device for testing clustering software | |
CN105786787B (en) | Efficient PDF reports test method based on Java | |
CN104239202A (en) | Non-Root testing method and system of interactive intelligent equipment | |
CN107423105A (en) | A kind of automatic generation method of interface document | |
CN109086148A (en) | A kind of cross-platform method for calling Web Service service | |
AU2011100465A4 (en) | Method and system for universal test scripting software | |
CN107102923A (en) | The method of testing that a kind of automatic carry out BMC Web user additions and deletions change |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180306 |
|
RJ01 | Rejection of invention patent application after publication |