Apache JMeter

@loveagileqa

qualityworkscg.com

Installing JMeter

Installing JMeter

 JMeter Components

Step 1: Install Java

JMeter is a pure Desktop Application. You will need to have a JVM 6 or higher. You can always download the latest version.

Click to download Java

Step 2: Download Jmeter

Click to download Jmeter

Choose the binary file (either zip or tgz) to download as shown below

Step 3: Install Jmeter

To install JMeter, unzip the files into the directory that you want JMeter to be installed.  

Your installation directory for your Apache JMeter should look like the image on the left.

You can start JMeter in three (3) modes:

  1. GUI Mode
  2. Server Mode
  3. Command Line Mode

Step 4: Run Jmeter

GUI Mode

To run JMeter in GUI mode, go to the bin directory and click on JMeter's executable jar file.

GUI Mode

Additionally, to run JMeter in GUI mode, you can run the jmeter.bat file in Windows. For Linux/Mac run the jmeter.sh file.

Server Mode

Server Mode is used for distributed testing. You would use this with the client-server model.

To start the server mode, run the bat file. This is in bin/jmeter-server.bat as shown below

Command Line Mode

You can also run JMeter from the command line

Here is an example: jmeter -n -t QualityWorksTest.jmx -l log.jtl -H 127.0.0.1 -P 800

JMeter Components

Installing JMeter

Performance Test

JMeter Components

There are several JMeter components that you need too know before you can begin testing. The most common components include:

  1. Thread Group
  2. Samplers
  3. Listeners
  4. Timers

Thread Groups

A Thread Group is a collection of threads. A thread represents a user that will carry out specific actions.

Let us say John, Susan, Mary and Paul visit www.google.com. That would be four threads. JMeter will create and simulate these four users accessing Google.

Samplers

Samplers inform the Thread Group (Users) of the type of request it is to make. The requests are processed in the order they are made.

There are different request that can be made. They include: HTTP Request, FTP Request, JDBC Request,Java object request, LDAP Request and WebService (SOAP) Request

Listeners

Listeners show the result of the test. There are various Listeners that will display the results in different formats.

Timers

Timers add a delay between each request a user makes. A timer makes a test more realistic as all users will not visit the site at the same time.

You are now ready to start running Tests! 

Perfomance Test

 JMeter Components

What is Performance Testing?

Performance Testing refers to the process of determining the effectiveness of a computer/device, network, software or application when exposed to certain conditions.

JMeter Performance Testing includes Load Testing and Stress Testing 

Load Testing

This is usually carried out to determine how the system will behave when being used by the expected number of users.

The amount of users using the system would constantly be increased over a specific time period.

Stress Testing

This is usually carried out to determine how well the system will perform if the load is beyond that which is expected. Stress Testing tries to break the system under test by overwhelming its resources or by taking resources away from it (in which case it is sometimes called negative testing). The purpose of this is to ensure that the system fails and recovers gracefully.

Performance Testing with JMeter

This performance test will be done on Google using 500 Users.

Step 1. Add Thread Group

The ramp up period tells JMeter how long it should take before all the users have executed the required action.

The loop count states the number of times each user will repeat the action.

Step 2. Add JMeter Elements

The Config Element (HTTP Request Default) allows JMeter to go a specific website at all times. If you wanted to go to www.google.com/images then you would enter images in the HTTP Request Path as indicated below. Ours is blank as we want to go directly to www.google.com

Step 2. Add JMeter Elements

The Listener will allow you to view the result of your test. For this test we will choose the Graph and the Table.

Step 3. Add Listener

Click the green button to run your test. You can view the results in the Graph and the Table.

Step 4. Run Test

The Graph and Table will display to you the results of the test.

Step 4. Run Test

Add a constant Timer. A Timer makes the test more realistic. We will be testing www.google.com with 100 users going to the site twice at a constant interval of 6000 ms

Using Timers

The timer added a constant interval of 6000 ms

Using Timer

Congratulations!

You have just ran your first Performance Test.

Made with Slides.com