Saturday, March 30, 2013

Introduction to Jmeter..!!


Apache JMeter is a 100% pure Java desktop application designed to load test client/server software (such as a web application ). JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can also use Jmeter for regression testing by introducing assertions in test script.


Now let's perform a simple load test on web application...


Firstly, what we have to do is setup Jmeter environment on our system.

Jmeter is a Java application, so a JRE or SDK first needs to be installed with a JAVA_HOME environment variable.
Setting Path on Windows
Windows 7
1. Select Computer from the Start menu
2. Choose System Properties from the context menu
3. Click Advanced system settings > Advanced tab
4. Click on Environment Variables, under System Variables, find PATH, and click on it.
5. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
6. Reopen Command prompt window, and run your java code.
Windows XP
1. Start -> Control Panel -> System -> Advanced
2. Click on Environment Variables, under System Variables, find PATH, and click on it.
3. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
4. Close the window.
5. Reopen Command prompt window, and run your java code.
Windows Vista
1. Right click My Computer icon
2. Choose Properties from the context menu
3. Click Advanced tab (Advanced system settings link in Vista)
4. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
5. Reopen Command prompt window, and run your java code.


Jmeter can be downloaded from this link:


• Download Jmeter, and install by unzipping the .zip or .tgz file in any directory.
• Go to jakarta-jmeter Directory (Directory in which the .zip of .tgz file is unzipped)
• Type ./bin/JMeter on command prompt (for UNIX) or Run bin/jmeter.bat (for Windows)
• JMeter is ready to test application.
When you run JMeter.bat file in bin directory of jakarta-jmeter Directory, you will see the following JMeter Screen.
The user interface has two panes. The left pane displays the elements used in our testing. Initially, there are the Root and two sub-elements, Test Plan and Workbench.
Test Plan: A test plan describes a series of steps JMeter will execute when run. A complete test plan will consist of one or more Thread Groups, logic controllers, sample generating controllers, listeners, timers, assertions, and configuration elements.
Workbench: Workbench is place where we store test elements which are saved and used in later stages. It has two elements which are HTTP proxy server and HTTP mirror server. Http proxy server is used for recording purpose. To use it right click on workbench then select Add --> Non-Test Elements --> HTTP Proxy Server.
This is how we install and run JMeter in windows.

No comments: