24
By Bharath kumar.M

J meter introduction

Embed Size (px)

Citation preview

Page 1: J meter introduction

ByBharath kumar.M

Page 2: J meter introduction

J Meter introduction:

• It is a open source software from Java to load test functional behavior and measure performance. Testing a web application against heavy load, multiple and concurrent user traffic.

• For example: one day, your boss asks you to do performance testing of www.google.com for 100 users. What would you do?

• Answer is J-meter• It will stimulate multiple user at a time as per the request• JMeter originally is used for testing Web Application or FTP

application. Nowadays, it is used for functional test, database server test etc.

Page 3: J meter introduction

Why JMeter ?

1. JMeter is totally free, allows developer use the source code for the development

2. JMeter is 100% pure Java desktop application. So it can run on multiple platforms

3. JMeter supports many testing strategies such as Load Testing, Distributed Testing, and Functional Testing.

Page 4: J meter introduction

How does JMeter work ?

Page 5: J meter introduction

Architecture of J-meter

Page 6: J meter introduction

Thread Group

• Thread Groups is a collection of Threads. Each thread represents one user using the application under test. Basically each Thread simulates one real user request to the server.

• The controls for a thread group allow you to Set the number of threads for each group.

• For example, if you set the number of threads as 100; JMeter will create and simulate 100 user requests to the server under test

Page 7: J meter introduction

Thread Group

Page 8: J meter introduction

Samplers

• As we know already that JMeter supports testing HTTP, FTP , JDBC and many other protocols.

• We already know that Thread Groups simulate user request to the server• But how does a Thread Group know which type of requests (HTTP, FTP etc.) it

needs to make ?• The answer is Samplers• The user request could be FTP Request, HTTP Request, JDBC Request…Etc.

Page 9: J meter introduction

FTP request:

• You can use FTP request sampler to perform test an FTP server • This controller lets you send an FTP “download file” or “upload file” request to an FTP server.

HTTP request:• This sampler lets you send an HTTP/HTTPS request to a web

server.• JMeter send a HTTP request to Google website and retrieve

HTML files or image from this website.

JDBC request:• It sends a JDBC Request (an SQL query) to a database.

Page 10: J meter introduction

Logic Controllers

• Logic Controllers let you define the order of processing request in a Thread. For example, you can use Random Controllers to send HTTP requests to the server randomly.

• Logic Controllers determine the order in which user request are executed.• commonly used Logic controllers are

Page 11: J meter introduction

Recording Controller

JMeter can record your testing steps; recording controller is a place holder to store these recording steps.

Simple ControllerSimple Controller is just a container for user request.

Loop Controller

makes the user request run specified number of times

Page 12: J meter introduction

Listeners• A listener is a component that shows the results of the samples. • The results can be shown in a tree, tables, graphs or simply written to a log file.

Configuration Elements

• set up defaults and variables for later use by samplers.

Page 13: J meter introduction

• Suppose you want to test a website for 100 users signing-in with different credentials.

• You do not need to record the script 100 times! You can parameterization the script to enter different login credentials.

CSV Data Set Configuration

HTTP Cookie Manager• HTTP Cookie Manager also has the same feature like a web browser. • If you have an HTTP Request and the response contains a cookie, the Cookie

Manager automatically stores that cookie and will use it for all future requests to that particular web site.

HTTP request default

• This element lets you set default values that your HTTP Request controllers use.

Login Configuration Element• The Login Configuration Element lets you add or override username and

password settings in samplers.

Page 14: J meter introduction

Assertions• Assertion help verify that your server under test returns the expected

results.• Commonly used Assertion in JMeter:

1.Response Assertion2.Duration Assertion3.Size Assertion4.XML Assertion5.HTML Assertion

Response Assertion

• The response assertion lets you add pattern strings to be compared against various fields of the server response.

Duration Assertion• The Duration Assertion tests that each server response was received within

a given amount of time. Any response that takes longer than the given number of milliseconds (specified by the user) is marked as a failed response.

Page 15: J meter introduction

Size Assertion• The Size Assertion tests that each server response contains the expected number

of byte in it. You can specify that the size be equal to, greater than, less than, or not equal to a given number of bytes.

Timers

• JMeter sends the request without pausing between each request. In that case, JMeter could overwhelm your test server by making too many requests in a short amount of times.

• To overcome this we are using timers• common types of timer in JMeter

Constant Timer:• Constant timer delays each user request for the same amount of time

Gaussian Random Timer:• Gaussian random timer delays each user request for a random amount of

time

Page 16: J meter introduction

Total Time delay

• Other Timer used in J-meter is Ben shell timer, BSF Timer, JSR223, Uniform random timer

Processor

• Processor is used to modify the Samplers in their scope.

Page 17: J meter introduction

There are 2 Types of processors:

1.Pre-processor2.Post-processor

Pre-processor

• Pre-processor executes some action before making Sampler Request.

• A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren't extracted from response text.

Page 18: J meter introduction

Post-processor

• Post-processor executes some action after making a Sampler Request.

• A Post-Processor is most often used to process the response data, often to extract values from it.

Page 19: J meter introduction

J meter : Performance Testing• Performance testing is crucial to determine that the web application under test will

satisfy high load requirements. It can be used to analyze overall server performance under heavy load.

• J meter performance testing includes both Load test and Stress Test

• Load Testing Help us to study the behavior of the application under various loads

• The main parameter to focus is response time.

• Stress Testing Help us to observe the stability of the application.

• The main parameter to focus is throughput.

Page 20: J meter introduction

Sample Performance Test Plan in J meter

• performance analysis of Google.com for 10 users

• Before testing the performance of target web application, we should determine-

Normal Load: Average number of users visit your website Heavy Load: The maximum number of users visit your website

What is your target in this test?

• Roadmap of this practical example

Page 21: J meter introduction

Step 1) Add Thread Group

Right click on the Test Plan and add a new thread group

Add –> Threads (Users) –> Thread Group

In Thread Group control panel, enter Thread Properties

A. Number of threadsB. Ramp-up periodsC. Loop count

Step 2) Adding J Meter elements

This element can be added by right-clicking on the Thread Group and selecting

Add –> Configuration Element –> HTTP Request Defaults.

Enter the website you want to test

Page 22: J meter introduction

HTTP Request

Right-click on Thread Group and select

Add –> Sampler –> HTTP Request

J Meter will create the URL request to Google server

Step 3) Adding Graph result

J Meter can show the test result in Graph format.

Add –> Listener –> Graph Results

Step 4) Run Test and get the test result• Press Run button (Ctrl + R) on Toolbar to start the testing process. • You will see the test result display on Graph at the real time.

Page 23: J meter introduction

Test Result will look like

Page 24: J meter introduction

THANK U