JMeter and Taurus Training (2/3)
By: Melissa Huerta
Tags: Taurus, Load Testing, Jmeter, Performance Engineering

In previous sessions, installation and HTTP Request creation were covered. If you haven’t read about it, check this article first.

Now we will learn how to parameterize using CSV Dataset config using controllers as Once Only Controller! ✍🏽

Parameterization: parsing the information of the body from the test data, that could be a script or an external file.

👩🏽‍💻 Activity: Create a new HTTP Request according to the API

☞ Open a new JMeter Test and create a thread group.

☞ Under the thread group, create a HTTP Request and add a HTTP Header Manager.

Steps to add a ‘HTTP Header Manager’

☞ Then add a “View Results Tree” to the Thread Group, so you can view the results when the test is executed.

Tree structure after creating the HTTP Header Manager

To do this task, we will use a json API “Create Post”

☞ API provided: here, on the HTTP Request, you must fill this data:

HTTP Request for creating a post using an API.

HTTP Request body structure.

☞ Save your Test Plan and run it.

You can see the results in Results Tree > Body

👩🏽‍💻 Activity: Use csv files

Working in the same exercise.

☞ Add “CSV Data Set Config” to the thread group.

Steps to add ‘CSV Data Set Config’

☞ Create a csv file and add it to your “CSV Data Set Config”

Since, the API for creating a post only accepts 2 values, the csv file for this example should follow this format <title>,<body_content>

csv file format

Filename : indicate the location and the name of the csv to import.

: indicate the location and the name of the to import. Variable names : indicate the name of the properties of the object, for creating a post with the API provided, will be ‘tittle’ and ‘body’.

: indicate the name of the properties of the object, for creating a post with the API provided, will be ‘tittle’ and ‘body’. Ignore first line : in case your csv has the headers included (“title,body”), in this exercises we are not including the headers in the file so we shouln’t ignore the first line.

: in case your has the headers included (“title,body”), in this exercises we are not including the headers in the file so we shouln’t ignore the first line. Recycle on EOF : setting this to true will re-read the file provided after it hits to the end of file, e.g if you run a test of N users, being N a greater number than the amount of test values you provided, then it is recommended to set this to True .

: setting this to true will re-read the file provided after it hits to the end of file, e.g if you run a test of N users, being N a greater number than the amount of test values you provided, then it is recommended to set this to . Stop thread on EOF: setting this to true will make the test stop whenever it reaches the end of file.

CSV Data Set Config parameters

☞ Change the number of threads to run inside “Thread Group” (e.g. 25), change the values in Body Data inside the “HTTP Request” and run the test!

☞ You should get something like this:

Results Tree

👩🏽‍💻 Activity: Create a Once Only Controller

This is used to group the requests we want to execute only once (e.g login process). Every request inside “Once Only Controller” will execute one per thread created.

☞ Create a “Once Only Controller” and add a “Create Post” request to it.

Steps to add ‘Once Only Controller’

Tree structure after adding ‘Once Only Controller’

☞ In “Thread Group” set: Number of thread = 1 and Number of loops = 4. Now run the test plan!

Setting Thread Group properties

You’ll get this results 👇🏽👇🏽