Jmeter Tutorial Part 3

Part 3 – Organizing your jmeter test

How to automatically group your test elements into Transaction Controllers

You can allow jmeter to group your nodes into Transaction Controllers by selecting this dropdown value in the HTTP(S) Recorder:

01_https

It is a good practice to keep all associated page events under a page level Transaction Controller.  For example, a controller called “Login” should contain the login post request and any associated authentication requests.

If you would rather record all HTTP requests and group into controllers afterwards, there is nothing wrong with that approach.  Make sure you pay attention while recording so you can understand what each request does.

02_requests

What to delete and what to keep

Generally, you want to keep any HTTP Requests that are generated when recording.  Sometimes the recorder will automatically disable certain requests.  Save those in case you need them later.

You can always right-click or use the toggle button 03_toggle to switch between Disable/Enable

Warning — when you right-click to Remove/Delete something, it is gone forever !

Google Analytics Requests (unless you are asked to include these in your script) can be deleted or disabled:

04_analytics

Assets like Images, Logos, Javascript, and CSS do not need to be a part of your script.

05_bing

I would suggest putting all of the assets for a page inside a controller, and then disabling it.  You can always re-enable this controller if you need the assets later.  Make sure to give your controller a meaningful name like “Assets”:

06_assets

How to add variables to your UDV

Jmeter allows you to add parameters to your test.  In an ideal situation, you only need to write a test once.  Then it can be used in multiple environments by simply changing parameter values in the UDV.  However, this will not always be the case, so you might need to maintain separate tests for different environments.

For example, this UDV contains three parameters:

  • Server
  • Port
  • Protocol

07_udv

How to apply parameters to test elements

BEFORE:

08_before

AFTER:

09_after

As you can see, these variables can be accessed by adding the dollar sign with curly brackets.

Make sure to apply these parameters to your HTTP Header Manager elements as well:

10_header

What the test tree should look like

Your test tree should be a collection of test elements, divided into three main areas:

  1.  12_config  Config Elements
  2.  13_controller  Transaction Controllers
  3.  14_listener   Listeners

All of these elements should be rolled up under a Thread Group:

11_tree