Adding Thread Group, Sampler and Listener in JMeter | Learn JMeter

 





To add a Thread Group, Sampler, and Listener in JMeter, follow these steps:


  • Open JMeter and create a new Test Plan by selecting File > New.
  • Right-click on the Test Plan element in the tree view and select Add > Threads (Users) > Thread Group.
  • In the Thread Group properties window, set the number of threads (i.e., virtual users) that you want to simulate. You can also set the ramp-up period, which is the time it takes for all threads to start running, and the loop count, which is the number of times that the thread group will execute.
  • Right-click on the Thread Group element and select Add > Sampler > HTTP Request.
  • In the HTTP Request properties window, set the Server Name or IP, the Port Number, and the Path. You can also specify the HTTP method (e.g., GET, POST), the parameters, and the headers.
  • Right-click on the Thread Group element and select Add > Listener > View Results Tree.
  • In the View Results Tree properties window, select the fields that you want to display, such as the response code, response message, and response data.
  • Run the test by selecting Run > Start from the menu.
  • Once the test is complete, view the results in the View Results Tree listener by expanding the nodes in the tree view.


Here is a more detailed explanation of each step:


1. Open JMeter and create a new Test Plan by selecting File > New.

This step is self-explanatory. It creates a new Test Plan, which is the container for all the elements of your performance test.


2. Right-click on the Test Plan element in the tree view and select Add > Threads (Users) > Thread Group.

This step adds a Thread Group element to the Test Plan. The Thread Group specifies the number of virtual users (threads) that will be used in the test.


3. In the Thread Group properties window, set the number of threads, ramp-up period, and loop count.

The Number of Threads property specifies the number of virtual users that will be used in the test. The Ramp-Up Period property specifies the time it takes for all threads to start running. The Loop Count property specifies the number of times that the thread group will execute.


4. Right-click on the Thread Group element and select Add > Sampler > HTTP Request.

This step adds an HTTP Request sampler to the Thread Group. The HTTP Request sampler simulates an HTTP request sent by a virtual user.


5. In the HTTP Request properties window, set the Server Name or IP, Port Number, and Path.

The Server Name or IP property specifies the web server that the virtual user will access. The Port Number property specifies the port number of the web server. The Path property specifies the path to the web page or resource that the virtual user will access.


6. Right-click on the Thread Group element and select Add > Listener > View Results Tree.

This step adds a View Results Tree listener to the Test Plan. The View Results Tree listener displays the results of the performance test.


7. In the View Results Tree properties window, select the fields that you want to display.

This step allows you to customize the View Results Tree listener to display the fields that are relevant to your test.


8. Run the test by selecting Run > Start from the menu.

This step runs the performance test.


9. Once the test is complete, view the results in the View Results Tree listener by expanding the nodes in the tree view.

This step allows you to view the results of the performance test in the View Results Tree listener. You can expand the nodes in the tree view to view the details of each HTTP request sent by the virtual users.




Post a Comment

Post a Comment (0)

Previous Post Next Post