Skip to main content

JMeter Transaction Controller

· 3 min read
Avi Stramer

JMeter is a popular open-source performance testing tool used by software testers and developers to test the performance and functionality of web applications. One of the essential but often overlooked features of JMeter is the Transaction Controller. In this blog post, we will discuss what the JMeter Transaction Controller is, how it works, why someone would use it, and show an example.

What is the JMeter Transaction Controller?

A Transaction Controller measures the response time of a group of requests (or samplers in JMeter speak) as a single transaction. This can be extremely useful for measuring the response time of related requests.

How does the JMeter Transaction Controller work?

The Transaction Controller works by grouping requests together under a single parent element. The parent element is the Transaction Controller, and the child elements are the requests that make up the transaction. When the transaction is executed, JMeter measures the response time of the entire transaction, which includes the response time of each individual request.

A transaction controller can include child transaction controllers. There is no limit to how deep your transaction hierarchy can go.

If you check the "Generate parent sample" checkbox the transaction response time is reported as the parent of the individual requests that make up the transaction. If it is unchecked the transaction response time is reported separately and not correlated to the individual response times in the results.

If you check the "Include duration of timer and pre-post processors" checkbox, the Transaction Controller includes the duration of the timer and pre-post processors in the response time.

Why would someone use the JMeter Transaction Controller?

  1. Measuring the response time of a transaction: By grouping related samplers together under a single transaction, the Transaction Controller allows testers to measure the response time of the entire transaction. This helps identify any bottlenecks in the system that could affect the overall performance.

  2. Simplify and provide a logical structure to the test plan: Grouping related requests together makes your test plan simpler and more logical, making it easier to read and manage.

An example test plan

Below is an example of how you can use the transaction controller to simplify and group requests in your test plan. In this example we are testing an e-commerce site order flow. This set up will provide us performance metrics for each step, the total time to configure an order, the total time to place the order, and the total time overall.

Example transaction controller

And here is what the response times would look like using the JMeter Results Tree Viewer:

Results tree viewer

And the same thing run on Testable.io:

Results Testable view

Conclusion

The Transaction Controller is an essential component that allows testers to group related requests together and measure the response time of the entire transaction. It can simplify and provide a logical structure to the test plan as well. This then helps testers identify bottlenecks in the system and improve overall performance. If you are using JMeter for performance testing, the Transaction Controller is a feature you should definitely consider using.