by Dzmitry Kashlach
Generally, we discuss using different elements of JMeter. But often, JMeter is used for implementing more complex tasks.
So today, we'll show you how to create an entire script.
For script creation, we've used the Mantis bug tracker as an application under test. it's been set up at a local web-server to avoid the influence of network connections. In other words, we only want to see the behavior of the application itself.
So, what's our use case? We're testing a bug tracking system. Our supposed users are project managers that create and delete projects. To better follow along, we suggest a quick, local Mantis BT set up so you can replicate the scenario.
Mantis BT is an open source application.
Let’s jump right in:
Loading the Main Window of the Application.

Switch to the “Manage” Tab.

Switch to the “Manage Projects” Page.

Create A New Project.

In general, the app interface is very simple. The operation of a project deletion is nearly the same, just go to a particular project and press the “Delete” button.
Two Thread Group Test Scenarios: Creators and Deleters.
Our test scenario will also contain the “Action Storage” Thread Group. As seen below, the “Action Storage” Thread Group is disabled, which means it cannot run.
We use it to store pieces of script that can be used via Module Controllers in other active Thread Groups.
This is what we will have at the end (collapsed):

We've used the support elements: HTTP Request Defaults, User Defined Variables and the HTTP Cookie Manager.
HTTP Request Defaults

We've selected a “localhost” because we have installed Mantis BT locally.
User Defined Variables:

Full URL to Mantis -> http://localhost/mantisbt/login_page.php
So, the “localhost” is placed into the HTTP Request Defaults. “mantisbt” is defined as JMeter variable PATH. The last part is the precise path-to-page that we need.
HTTP Cookie Manager: We need this element to perform a login operation only once per test execution. As you know, it should be used for storing cookies and we don't mean in the cookie .jar.
“Creators” Thread Group
This group is responsible for creating projects.

Note that the “Login to Mantis” operation consists of two sub-items: “Open Login Page”(2.1.1) and “Login as Administrator” (2.1.2)
“Open Login Page” is Module Controller.

It is linked to “Open Login Page” in “Action Storage”.

As you see, it includes HTTP Request to login_page.php and HTTP Header Manager. Nothing difficult.
Next step. “Login as administrator” (2.1.2).
It is Parametrized controller, note that this is NOT the default element for JMeter, but a part of a Google Plugins project.

Here we added two parameters for login operations to Mantis BT.
- username = administrator
- password = root
It has a child element, “Login as Administrator”(2.1.2.1)

It refers to “Action Storage”->”Login(username, password)”

Here we transfer parameters from “Login as Administrator” Parametrized controller.
Then we have another request with parameters that should be displayed.

Third request in this controller does not have any parameters.
The main part of “Creators” Thread Group IS “Creating project” in the Module Controller.


It contains 6 HTTP Request samplers.
Let’s walk through each of them to review details.

“manage_overview_page.php” and “manage_proj_page.php” do not contain any parameters.
The next piece of script is very important. Here we will use correlation.

Note that “manage_proj_create_page” does not take any parameters. However, this request is key in the creating project process. If you open its HTML code, you will see that it has a hidden field “manage_proj_create_token”.
We need to capture this value and transmit it further because we won’t be able to create project without it.
Transmitting values from one request to another is called correlation.

So, the Regular Expression Extractor is what we need. Let’s look into it.

Here we see that the value needed is stored in variable ${manage_proj_create_token}. Go further, the value we’ve captured earlier is used in POST request.

And now we’ve come to last request in this group.

Here is full list of parameters:
- manage_proj_create_token = ${manage_proj_create_token}
- name = ${__Random(0,1000000)}
- status = 50
- view_state = 10
- inherit global = on
- file_path =
- description = ${__RandomString(15,sdKSDJHGKJHGlkjhalkjdhlkjhqoieuroqiuery)}
After that we have a simple GET request

Let’s go to the second part of script.
“Deleters” Thread Group

There is no need to describe the “Login Once Only” element with its tree, because it is the same as in “Creators” Thread Group.
The key differences are in “Deleting project” module controller. So, let’s turn to Action Storage and see the details.

“manage_proj_page.php” request has no interest for us as a standalone request because it is an empty GET request. But we do need to extract the "project_id" that we want to delete.
So, for this purpose we will use the Regular Expression Extractor.

Using JMeter variables, we’ll pass “project_id” to “manage_proj_edit_page” as a parameter for POST Request.

And again, we need to extract the hidden value, “manage_proj_delete_token”.

Now, we are ready for the deletion project.
Send “manage_proj_delete” POST request.
It has the following parameters:
“manage_proj_delete_token” = ${manage_proj_delete_token}
“project_id” = ${project_id}
The next POST request is almost the same, but it has additional parameter “_confirmed”=1

The last request is simple GET request, which returns us page with the list of projects, “manage_proj_page.php”
Viewing this example should help you create your own test scripts. If you need an expert to create them for you, BlazeMeter has a team of scripting experts who can help.
Have you tried our free plugins and modules for simplified load testing yet?
BlazeMeter's Plugin to Jenkins CI
Visit BlazeMeter's Knowledge Base for more resources and tutorials on JMeter and load testing.

Add new comment