The following is the procedure to record and conduct load testing with JMETER.

JMETER

Apache JMeter is a 100% pure Java Desktop application designed to load-test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions. JMeter can be used as a unit test tool for JDBC database connections, FTP, LDAP, Web services and JMS.

If you are not aware of the basics related to JMETER then please refer to the following link for 10 min before reading this complete article.

http://jmeter.apache.org/usermanual/build-web-test-plan.html

The JMETER tool looks difficult to understand quickly since the new user does not have the basic knowledge to create a load test environment. This article will concentrate only on one of the best ways to record a web application using Workbench (file provided in code files) and run load tests in a similar way, like fro example QTP or Visual Studio - CodedUI.

Difference between performance and load testing

JMETER-1.jpg

Load Testing Tools

JMETER-2.jpg

Various types of load test variants

JMETER-3.jpg

Example of Requirement of load testing:

To analyze the load testing results:

Terminology

Before we dive into the step-by-step instructions, it's a good idea to define the terms and ensure the definition is clear.

Master: the system running Jmeter GUI, that controls the test
Slave: the system running jmeter-server, that takes commands from the GUI and send requests to the target system(s)
Target: the webserver we plan to stress test

Note: Starting the Test

Before start load testing, if you want to double check that the slave systems are working then open jmeter.log in Notepad. You should see the following in the log. Jmeter.engine.RemoteJMeterEngineImpl: Starting backing engine. If you do not see this message then it means the JMETER server did not start correctly.

  1. Download JMETER binary release from http://jmeter.apache.org/download_jmeter.cgi
  2. Extract the zip file and go to bin folder.
  3. Double-click "jmeter.bat"
  4. This will start the JMETER application and the following screen will be displayed:

    JMETER-4.jpg

    Part 1: How to record your web applications using Workbench for load test.

    As mentioned above, JMETER looks like a difficult tool to understand quickly, since the new user does not have the basic knowledge to create a load test environment. The following provides one of the best ways to record the web application using Workbench and run load tests like for example QTP or Visual Studio - CodedUI.
  5. Go to File Open.
  6. Browse the sample test plan attached with this article for TestPlan2.jmx.jmx or Sample.jmx and click open.
  7. This will open the screen as shown below:

    JMETER-5.jpg

  8. Click on TestPlan2 on the left panel and edit the field "Number of Threads(users)": 25 on the right panel. Provide the desired figure with which testing is required to be conducted.
  9. Click on "HttpRequestDefaults" on the left panel and edit the Server Name or IP : 152.425.306.120 and Port Number:8080 (if the Tomcat Server is running on port other than 8080) on the right panel. Do not give the Server Name as "localhost". The field should contain the machine name or IP.
  10. There are already 3 http requests created. In other words Login, File Browser and Search. You can run the test plan to test performance for these 3 requests. You can also add new requests to test against specific criteria. This is discussed later on.
  11. In order to run the test plan, go to Run Start. Please ensure the Tomcat Server is running.
  12. This will start executing the test plan.
  13. Once the test plan execution is complete, you can see the result in various formats as explained below.
  14. Click on Graph Results on the right panel. This displays the time taken for each request by plotting the requests on the x-y axis.

    JMETER-6.jpg

  15. Click on "View Results" in the table to see the results in tabular format

    JMETER-7.jpg

  16. Click on View Results Tree to view request and response data for each request.
  17. Click on "Aggregate Graph". Then click on "Display Graph" on the right panel. This will render the results in a graphical view.

    JMETER-8.jpg

  18. In order to create your own request for a specific search criteria, a proxy server needs to be set up that will record the request to be tested.
  19. Right-click on WorkBench and select "Merge". Browse through the file "WorkBench.jmx" and click on "Open".
  20. Click on "Http Proxy Server" on the left panel. By default, the proxy server is configured to run at 9080 port. If you want to run on a different port then edit the Port field on the right panel and then click on the Start button present towards the end. This will start the proxy server.

    JMETER-9.jpg

  21. Now open Internet Explorer and login into OpenEDMS. Again ensure you access the application with server name or IP and not localhost.
  22. Click on the "Advance Search Tab".
  23. In order to start recording the search, the proxy server needs to be set up in IE.
  24. Go to "Tools" | "Internet Options" | "Connections LAN Settings"

    JMETER-10.jpg

  25. Tick the checkbox "Use a proxy server for your LAN" and provide the address and port as per the configuration done previously.
  26. Now as soon as you click on "Search" after filling the search criteria, a new request will be added in JMeter as shown.

    JMETER-11.jpg

  27. You can provide some meaningful name instead of "/edms/servlet/edms.do" for example Report Search in the Name field on the right panel

    JMETER-12.jpg

  28. Now drag on the Report Search item on the left panel and place it above the Graph Results as shown below.

    JMETER-13.jpg

  29. This way you can create your own search criteria to be tested. Now follow the same procedure to run the test as was mentioned earlier and view the results in desired formats.