Skip to content
Swarmetry

Build scenarios

Transactions: measure the business time of a journey

Measure the business time of an action, thresholds in plain language, follow transactions live and in reports.

A request time tells you how fast one server answer was. Your users wait for a whole action: signing in, adding a product to the cart, paying. A transaction measures that action from its first step to its last one, and you can set thresholds on it, follow it live and find it in the analysis and the reports.

Add a transaction

In the workflow editor, add Transaction (palette Logic) and put the steps of the action inside it: requests, browser steps, gRPC calls, WebSocket sessions, checks, other transactions.

A transaction in the editor

  • Name: what the reports show ("Login", "Checkout"). Up to 100 characters (fewer with many accents or emoji), without a comma, a brace or a quote, and without a space at the start or the end. Two transactions may share a name: their measurements add up (the same action in two flows, for example).
  • Include think time: off by default, the pauses inside the transaction are not counted in its duration (a user reading a page is not the site being slow). Turn it on to measure the time as the user lived it.
  • Transactions can be nested ("Checkout" holding "Pay"). They are not allowed in the setup and teardown of a scenario, which run once and are not part of the user journey.

The editor warns you about a transaction without steps, or with pauses only (its duration is then 0).

What is measured

Measurement Meaning
Duration the time from the start to the end of the transaction, without the pauses inside unless you included them
Success the transaction succeeded when no step inside failed: no error, no failed check, no missing required value, no unexpected HTTP status (outside the request's expected statuses, by default 200 to 399: a request that should answer 404 lists 404 in its Expected statuses), the iteration was not stopped

Every request, check and browser measurement made inside a transaction is labelled with it, so you can also see the requests of one transaction in the analysis (breakdown by transaction).

Thresholds in plain language

In the test configuration, the Thresholds in plain language builder above the thresholds table writes a threshold as a sentence: Fail the test when the 95th percentile of the Login transaction duration is above 2 s. (The 95th percentile is the time under which 95 % of the transactions finished: it shows what nearly every user lived, without being moved by a few very slow ones.)

The threshold sentence builder

  1. Choose the statistic (average, median, 90th, 95th or 99th percentile, minimum, maximum; the rate for success rates).
  2. Choose what is measured: a transaction's duration or success rate (or all transactions), the duration of all requests or of one request, the error rate, the checks passed, the iteration duration, or a Web Vital of browser steps (how fast a page shows its content and reacts).
  3. Choose is above or is below, type the value and its unit (ms, s or %).
  4. Tick and stop the test early to abort the test as soon as the threshold fails, then Add this threshold. A sentence on a measure that already has a threshold adds its condition to that threshold.

Every existing threshold is read back as a short sentence under the builder ("p95 of Login < 2 s": the test passes while the 95th percentile of Login stays under 2 seconds). A threshold that a sentence cannot say (several conditions, other filters, custom metrics) is still shown, and edited, in the table below.

When the scenario has transactions without a success threshold of their own, the problems of the test configuration suggest one: Add a success threshold per transaction adds "at least 95 % of the transactions succeed" (sw_transaction_ok rate>0.95) for each of them. A single threshold on all the checks averages every step, so one transaction failing most of the time could hide behind the others and the test would still pass. A new configuration without any threshold gets them with the default thresholds, and the assistant proposes them too.

The suggestion of a success threshold per transaction

Follow transactions

The transactions of a run

  • Live: the run page shows a Transactions panel when the scenario has transactions: the 95th percentile of each transaction over time (the 10 busiest), with the line of its threshold, and a table of count, success, average, 95th percentile and maximum, refreshed every 5 seconds.
  • Analysis: the Transactions table of a run (count, success, average, median, 90th, 95th and 99th percentiles, maximum), the comparison of runs per transaction, and the request breakdown by transaction.
  • Reports: a Transactions section (table), a transactions table in the CSV export and in the Markdown report. Each threshold condition on a transaction is a test case of the JUnit report.

Imported and recorded scenarios

  • Each marker you add while recording opens a transaction named after the marker, holding the steps recorded up to the next marker.
  • A JMeter Transaction Controller becomes a transaction. Its Include duration of timer and pre-post processors option becomes Include think time.
  • HAR pages and the groups of imported scripts stay groups: a group only organizes the steps, it measures nothing.

Ask the assistant

The assistant knows worked examples of transactions and of their thresholds. Ask it, for example: “measure adding to the cart as a transaction named Add to cart” in the workflow editor, then “fail when the p95 of Add to cart is above 2 s” in the test configuration editor.