Quantcast
Channel: Yudiz Solutions Ltd.
Viewing all articles
Browse latest Browse all 595

JMeter

$
0
0

Overview

The Apache JMeter is a pure java open source testing software. Firstly, JMeter was developed by Stefano Mazzocchi of the Apache Software Foundation. It is freely available as it is open source. JMeter was designed to do the Performance & Load Testing. It also covers functional & regression testing. JMeter is used for testing the Web Application or FTP Application. JMeter is used for database testing purpose nowadays. JMeter can be used to analyze & measure the performance of Web Application.

For Installation Purpose, it requires JDK 5 or higher. Compatible of running on any environment/workstation that accept JVM (Java Virtual Machine).

Working of JMeter

JMeter merge/combines a group of users that are sending the requests to the destination/target server and returns the results that shows the Performance of the target server/application. Results will be displayed in the form of Charts, Tables, Graphs, Trees or in the form of Log File.
Following Figure will help you to understand the working of JMeter easily.

jmeter-image1

Performance Testing

Performance Testing can be done using JMeter, Load Runner etc. Stress & Load Testing both are the parts of performance testing.

jmeter-image2

Few Elements of JMeter are discussed below

jmeter-image3

1.Thread Group

Collection of Threads is known as Thread Group. Each Thread represents a single user using the application under test.
If you set the number of threads as 1000.JMeter will create and combine 1000 user requests to the server under test.

jmeter-image4

2 Samplers

As we know that JMeter supports testing HTTP, HTTPS, FTP & many other protocols.
Thread Group simulate user requests to the server. The requests can be HTTP Request, FTP Request or JDBC Request etc. That is Samplers.

3. Listeners

Listeners displays the results of the execution of test. They display results in the form of Graphs, Trees, Tables as well in Log File.

jmeter-image5

4. Configuration Elements

CSV DataSet Config
For example, if you want to test a website for 1000 user’s login with different credentials then no need to record the scripts 1000 times. Username & Password will be stored in a text file. JMeter has an element that allows to read the username & password from that text file. It is CSV DataSet Config.

Login Config Element
It is used to simulate single user login. It is suitable for login parameter only.

Performance Testing using JMeter

Step 1: Insert Thread Group

  1. Run JMeter & Select the existing Test Plan.
  2. Then, Insert the Thread Group.
  3. Right Click on Test Plan & Insert a new Thread Group: Add -> Thread(Users) -> Thread Group.

jmeter-image6

Now, Enter Thread Properties in Thread Group as below.

jmeter-image7

Number of Threads- 1000 i.e. 1000 users are connected to the destination website.
Ramp Up Period- Time Delay before starting another user. 1000 users/1000 seconds thus the delay between each user will be 1 sec.
Loop Count- 10 i.e. Single user is connecting the website 10 times.

Step 2: Insert JMeter Elements

Right Click on Thread Group:
Add -> Config Element -> HTTP Request Defaults

jmeter-image8

Enter target server in server name or IP as HTTP runs on 80 port number thus enter 80 as given below.

jmeter-image9

Right Click on Thread Group: Add -> Sampler -> HTTP Request.

jmeter-image10

Example: If you enter calendar in Path Field, It will send URL request http://www.google.com/calendar to the Google Server.

If you put the path field blank, Apache JMeter will send the URL request http://www.google.com to the Google Server.

jmeter-image11

Here, I will put it blank.

Step 3: Insert Listener for viewing the results.

Add -> Listener -> Graph Results

jmeter-image12

You can view the results in the form of Graph, Table, Tree etc. Here I have selected Graph.

jmeter-image13

Step 4: Finally, Execute the Test & get the result

Click on Run & result will be displayed.

jmeter-image14

Throughput should be more & Deviation should be less which shows good performance. Server Performance is said to be good if Throughput is more & Deviation is less.

Database Testing using JMeter

Step 1: Insert Thread Group

  1. Run JMeter & Select the existing Test Plan.
  2. Then, Insert the Thread Group. Right Click on Test Plan & Insert a new Thread Group:
    Add -> Thread(Users) -> Thread Group.

jmeter-image15

Step 2: Insert JDBC Connection Configuration

  1. Right click on Thread Group.
  2. Then, Add -> Config Element -> JDBC Connection Configuration

Now, Add the Details in Database URL as jdbc:mysql://localhost:3306/registration_table where 3306 is port number, registration_table is my database. Add com.mysql.jdbc.Driver in JDBC Driver Class & Add root in Username.

jmeter-image16

Step 3: Insert JDBC Request.

  1. Right Click on Thread Group.
  2. Then, Add -> Sampler -> JDBC Request

Now, you can select any query type. Here, I am selecting Select Statement. Now, enter “select * from customer” where customer is my Table Name in registration_table Database.

jmeter-image17

Step 4: Insert Listeners for viewing the result

In this, I will add 2 Listeners such as View Results in Table, View Results Tree.

  1. Right Click on Thread Group.
  2. Add -> Listener -> View Results Tree.
  3. Again, Add -> Listener -> View Results in Table.

jmeter-image18

Step 5: Run JMeter

It will display the results in form of table as well as in tree.

jmeter-image19

jmeter-image20


Viewing all articles
Browse latest Browse all 595

Trending Articles