Simple example jmeter stress test script recording + badboy

 

 JMeter installation: downloaded from the Internet, after extracting zip after downloading, find JMeter.bat file in the bin directory, double-click to run JMeter. 

http://jmeter.apache.org/

 

Before using jmeter must first download jdk package, configured java environment. (See Java environment configuration tutorial)

 

After configuration check in the Run window to determine what java -version java environment configuration is complete.

 

 

First, (1) the use of automated scripts recorded badboy

 

Download and install BadboyInstaller-2.2.5.exe

Download: http://download.csdn.net/download/qq_28477081/8788911

 

After completing the Open Interface

 

Enter the URL in the address bar, click the Record button.

 

Recording steps are: Home -> Login -> enter a user name and password -> click the login button -> Home

 

After you finish recording the document is saved as: export to jmeter, generate a .jmx file.

 

 

(2) the use of a proxy server to record

badboy embedded browser ie8, part of the new site has not adapted ie8, these pages can be recorded using a proxy server.

 

Create a thread, used to store the recorded script

Add in the table: a non-test element -> HTTP proxy server, the proxy server set port number (typically set to 8080)

Native proxy settings in the browser, note that the port number is set with the proxy server port number set in the same

 

Set the target controller in the HTTP proxy, select the Test Plan> thread group, click start.

 

 

 

Second, the use of stress testing jmeter

 

Open just saved by badboy .jmx files in jmeter

 

 

Leaving a need to test the contents, put some extra content deleted during recording.

 

 

Set the thread group and listeners:

Thread Group: three parameters define the thread group are set: number of threads, Ramg-up Period (in seconds) (time interval), the number of cycles 

 

Assertion: Set response assertion, to check important node in response to the results are correct.

:( set response assertion assertion here is an example of the response page after checking whether the login information that identifies the user logged in "usr-name")

 

查看断言结果:

 

 

 

监听器:显示取样器结果的组件。为了观察来自提供的取样器的响应内容,可以添加“观察结果树”监听器,为了图形化观察响应时间,可以添加“图形结果”,查看完整的测试结果和通过率,可以添加“聚合报告”。

 

以上设置完成后,点击按钮,开始测试。

 

 

 

三、分析jmeter运行结果

 

一个简单的网页用户登录测试的结果:

 

1.聚合报告中的内容解释

#Samples:表示你这次测试中一共发出了多少个请求,如果测试计划模拟10个用户,每个用户迭代10次,这里就会显示100

Average:平均响应时间 — 默认情况下是单个 Request 的平均响应时间,当使用了事务控制器时,也可以以事务为单位显示平均响应时间

Min:最小响应时间

Max:最大响应时间

Error%:错误率,本次测试中出现错误的请求的数量 / 请求的总数

Throughput:吞吐量 —— 默认情况下表示每秒完成的请求数( Request per Second )

KB/Sec:每秒从服务器端接收到的数据量

 

2.查看结果树

所有的http请求都是绿色的,表示请求成功,如果请求失败则是红色的,结果树中还可以查看响应返回数据。

 

Guess you like

Origin www.cnblogs.com/lcl9668/p/11619747.html