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.

3 comments:

  1. Best Slots Casinos for 2021 | DMC
    Play 강원도 출장안마 free slots, games 충주 출장샵 and win real 여주 출장마사지 money on casino games. The best casino slot games offer great bonuses for 부산광역 출장안마 those who are passionate about 제주도 출장샵 gambling.

    ReplyDelete