Recently often use this tool jmeter interface automation testing company, the simple record -
One, written in easy cases csv file
First, fill in the relevant parameters (can be determined depending on the circumstances) in the first line of the csv file and write test cases. An interface which performs control script by priority parameter, performing interfaces at different ports simultaneously through port parameters, if you want to execute at different interfaces ip, ip may be a multi-parameter added, then read csv file parameterization.
Second, the design of test scripts and test execution
1, add a thread group
Right-test plan >> Threads (users) >> thread group, click Save.
2, add HTTP Request Defaults
Click thread group, right - added - Configuration element -HTTP request the default value.
3, add the result listener
Results monitor assembly view user interface test results , conventional polymerization report and see the results tree. Click the thread group - Add - Listener - Aggregate Report or view the result tree.
4, add the data cycle test controller reads csv file
4.1, the new loop controller in the thread group, the number of cycles is set to forever.
4.2, the new cyclic controller CSV Data Set ConFig controls
4.3, added with cases if the controller, do execution priority Screening Example
4.4 The method invocation mode selection request
By distinguishing if the selector GET and POST request method, configuration http request
POST请求的配置方式 :POST请求参数放在body data中
GET请求的配置方式:GET请求的参数配置url后面
4.5、配置响应断言
验证接口实际结果是否与用例中的预期结果一一致,可配置响应断言以及断言结果进行验证及查看。
5、执行测试并查看结果
执行脚本后,可通过查察结果树控件查看测试结果详情,绿色为通过,红色为不通过。可通过响应断言查看预期结果,与响应数据进行对比。
三、导出脚本
执行测试完成后可保存测试计划(测试脚本),以便后续验证回归。
以上操作,就完成jmeter接口(半)自动化~\(≧▽≦)/~啦啦啦~