JMeter之基本概念-The Test Plan

JMeter之基本概念-The Test Plan

The Test Plan is what JMeter is all about. If you have written or have used a test script/case before, you are ready to write  a JMeter Test Plan. In a simple analogy, JMeter Test Plan encapsulates a test script  that you would have written manually otherwise.

JMeter之基本概念-The Test Plan_第1张图片




What Is a Test Plan?

A Test Plan defines and provides a layout of how and what to test: the web application as well as the client server application. It can be viewed as a container for running tests. It provides a framework in which it will execute a sequence of
operations or tools to perform the testing. A test plan includes elements such as thread groups, logic controllers, sample-generating controllers, listeners, timers, assertions, and configuration elements. A test plan must have at least one
thread group.
The simplest Test Plan normally includes the following elements:


• Thread group—These elements are used to specify number of running threads, a ramp-up period, and loop-count (no. of times to execute the test).
Each thread simulates a user and the ramp-up period specifies the time to create all the threads. For example with 5 threads and 10 seconds of ramp-up time, it will take 2 seconds between each thread creation. The loop count defines the number of times the test will repeat for the thread group.
The scheduler also allows you to set the start and end of the run time. 

JMeter之基本概念-The Test Plan_第2张图片

• Samplers—These configurable elements are used to send HTTP, FTP, SOAP/XML, JDBC, or LDAP requests to a server.

  JMeter之基本概念-The Test Plan_第3张图片

Listeners—These elements are used to post-process request data. For example, you can save data to a file or illustrate the results with a chart. At this moment the JMeter chart does not provide many configuration options; however it is extensible and it is always possible to add an extra visualization or data processing module. 


例如:


JMeter之基本概念-The Test Plan_第4张图片

JMeter之基本概念-The Test Plan_第5张图片





As you run JMeter, Test Plan will appear as default component along with
Workbench on the left pane of the window.
The Test Plan Control Panel looks like this:

Workbench on the left pane of the window.
The Test Plan Control Panel looks like this: 



Each feature of this component is described as follows:
User Defined Variables: Here you can define static variables that allow you to extract repeated values throughout your tests, such as server names, port number,etc. For example, if you are testing an application on server www.example-jmeter.
net, then you can define a variable called "server" with the value of www.examplejmeter.net. This value will replace variable "${server}" found anywhere in the test plan.

Option Functional Test Mode: This will cause JMeter to record the data returned from the server for each sample and write this data to the file that you have selected in your Listener. You may use the Configuration button on a listener to decide what fields to save. This can be useful if you are doing a small run to ensure that your server is returning the expected results. However, as this option allows JMeter to save the maximum sample information, JMeter's performance will reduce.

If you are doing stress-testing, do not select this option, as it will affect your results.


If checked, this feature will save all information, including the full response log data and the default items, which are: time stamp, the data type, the label, the thread name, the response time, message, code, and a success indicator.


Option Run each Thread Group separately: If you have two or more Thread Groups in your Test Plan, selecting this will instruct JMeter to run each serially. Otherwise, JMeter will run Thread Groups simultaneously or in parallel.


Add directory or jar to classpath: This additive feature allows you to add JAR files or directories in case you have created your own extension to the JMeter package you are using. However, you will need to restart JMeter if you remove any entry.

Alternatively, you can copy all the jar files to the jmeter | lib directory. Another way to include additional libraries is to edit the JMeter properties file. In the jmeter. properties file, look for the entry "#user.classpath=../classes;../jars/jar1.

jar. Edit this to include additional libraries. Avoid naming paths containing spacesas this may cause problems for Java.



读书笔记:Apache JMeter


你可能感兴趣的:(JMeter)