Apache jMeter is a free and open source tool for performance testing. It has been build using JAVA, so it works fine on any platform. But to run jMeter you should have installed jdk5 or higher on your computer. If you have successfully installed jdk5 or higher on your computer you can proceed with jMeter installation. You can download it from this link :
Then extract the files to any location where you like. Now you can run jMeter using following command on your command line. I’m using linux on these examples.
Then it will open a GUI as follows.
A Test Plan can be viewed as a container for running tests. It defines what to test and how to go about it. A complete test plan consists of one or more 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. By right clicking on the test plan we can add elements to the test plan. Now let’s see about the available elements,
- Thread Group elements are the beginning points of your test plan. As the name suggests, the thread group elements control the number of threads JMeter will use during the test.
- Samplers allow JMeter to send specific types of requests to a server. They simulate a user request for a page from the target server.
- Logic Controllers let you control the order of processing of Samplers in a Thread. Logic controllers can change the order of a request coming from any of their child elements.
- A Test Fragment is a special type of element placed at the same level as the Thread Group element. It is distinguished from a Thread Group in that it is not executed unless it is referenced by either a Module Controller or an Include_Controller.
- Listeners let you view the results of Samplers in the form of tables, graphs, trees, or simple text in some log files. They provide visual access to the data gathered by JMeter about the test cases as a Sampler component of JMeter is executed.
- By default, a JMeter thread sends requests without pausing between each sampler. This may not be what you want. You can add a timer element which allows you to define a period to wait between each request.
- Assertions allow you to include some validation test on the response of your request made using a Sampler. Using assertions you can prove that your application is returning the correct data. JMeter highlights when an assertion fails.
- Configuration Elements allow you to create defaults and variables to be used by Samplers. They are used to add or modify requests made by Samplers.
- A pre-processor element is something that runs just before a sampler executes. They are often used to modify the settings of a Sample Request just before it runs, or to update variables that are not extracted from response text.
- A post-processor executes after a sampler finishes its execution. This element is most often used to process the response data, for example, to retrieve a particular value for later use.
After adding elements to the test plan you can change the customizations as you want. The test plan will work according to the customizations we have done. For an example,
- After adding a thread group, you can see it’s properties.
- Name : the name for the thread group
- Number of Threads : number of connection or the number of users
- Loop Count : number of iterations
- After changing these settings you have to click somewhere else like workbench and again click on the element to see the changes in effect.
You can simply save the test plan by,
File –> Save
File –> Save Test Plan As
File –> Save Selection As
Now let’s see how to run the test plan,
- You can simply run your test using the ‘Green Arrow‘ icon on the tool bar.
- After you start the run the stop and shutdown icons will be enabled.
- STOP : This will stop the run immidiately
- SHUT DOWN : This will stop the run after the thread has finished work.
- You can see the active thread count on the right corner of the GUI.
- If you have added a listener, then you can view the results like this.
Hope now you have a basic idea about Apache jMeter. From the next post I will talk more about creating different test plans. Until that see you. Thank You!