Showing posts with label Performance Plugin. Show all posts
Showing posts with label Performance Plugin. Show all posts

Monday, 14 January 2019

First HTTP request in JMeter | Running first JMeter Test

To create a basic script in JMeter, we need to add the following components:

  • Test Plan
  • Thread Group
  • Sampler
  • Listener

Test Plan:


The Test Plan is where the overall settings for a test are specified.Option is available on Test Plan to instruct JMeter to run the Thread Group serially rather than in parallel.Static variables can be defined for values that are repeated throughout a test under User Defined Variables section.
On the launch of JMeter, Empty Test Plan is generated.


Thread Group:


The first step you have to do with JMeter Test Plan is to add a Thread Group element. The Thread Group tells JMeter the number of users you want to simulate, frequency of requests, and how many requests they should send.

How to add Thread Group:


  • Right-click on the Test Plan,
  • Click Add menu → Threads (Users) → Thread Group.



JMeter Sampler


Samplers perform the actual work of JMeter. Each sampler generates one or more sample results. The sample results have various attributes like success/failure, time etc. and can be viewed in the various listeners. We will use HTTP Sampler to generate a HTTP request.

How to add HTTP Sampler:


  • Right-click on Thread Group,
  • Click Add menu → then select Sampler → HTTP Request.


JMeter Listener


Listeners perform several roles like listening to results, view, save, and read saved test results etc. We can save results is XML and CSV format. XML is default format. We will add 'View Results in Tree' Listener.

How to add Listener:


  • Right-click on Thread Group,
  • Click Add menu → then select Listener→ View Results Tree.




Project Hierarchy

Project hierarchy will look like this:

So far we have added all the required components to the script. Lets add some data to execute our first HTTP request and First JMeter Test.

Add Users:


We will run this test with single user, single iteration. You can generate load by increasing thread group count, iteration, ramp-up  as per requirement.



Add HTTP Request

For example purpose we will use w3schools.com to craft a basic GET call and SAVE the script.

  1. Add Protocol : https
  2. Server Name : www.w3schools.com
  3. Port: 443


Run Script:

CTRL + R

Clear Data and Run Script:

CTRL + E
CTRL + R

View Results:

Results of request/response is available under View Results in Tree Listener.

Tuesday, 25 December 2018

Jenkins Publish HTML Report for JMeter Test

To publish HTML report in Jenkins, first setup HTML report generation for JMeter Test. Please refer post HTML Report for JMeter Test

Add Build Goal and Post Build Action


With Parameters




Without Parameters


Add Post Build Action > Publish HTML Report



Specify HTML report directory path as defined in POM 

${basedir}/target/jmeter/results/dashboard/index.html

HTML Report