Getting Started with Assertions

User rating:
4 (4 ratings)

The content on this page is related to a deprecated version of LoadUI, which has been superseded by LoadUI NG Pro in the Ready! API platform. Click here to learn more.

This tutorial assumes that you are familiar with the basics of LoadUI and Statistics.

0.1. Video Tutorial

0.2. Preparations


The starting-point is a simple load test containing one Generator and one Runner. Start the project and then go straight to the Statistics Tab and drag the Runner from the toolbar to create a chart.

0.3. Creating Assertions

Let's pretend that we considered a TimeTaken of more than 100 milliseconds unacceptable. To create an assertion for this, go back to the main window of LoadUI and open the Assertions bottom panel. Now drag the icon representing your Runner to the empty assertion list.


A dialog that lets you configure your assertion will appear. All statistics that are available in the Statistics Tab are also assertable. Additionally, you can assert real-time values, meaning the actual value (not a per-second calculated Min, Max, Average, etc.). Chose Time Taken and then Real-time value. In the Constraint section, set Min to 0 and Max to whatever value makes sense for you. In this tutorial we'll set Max to 100, since we don't want requests to take more than 100ms.


Click Create and your new assertion will show up 1_snag_evi in the Assertions Bottom Panel. From now on, each time the constraint is violated, the assertion's Failures counter 2_snag_evi will increase.


To rename your assertion click in the assertions menu, and then click Rename.


0.4. Viewing Assertion Failures

Your assertion will now be available in the toolbar in the Statistics Tab. Drag it to a new or existing chart to see its failures.


Failures are represented as vertical lines in the graph. In some cases (when zooming out or when asserting real-time values), multiple failures may be grouped into a thicker vertical line.


Open the Event Log bottom panel and you will find that all assertion failures are logged in text format as well, with a bonus: It contains the actual value that caused the failure. The Event Log is part of the result and will be auto-saved together with the statistics.


0.5. Setting Failure Limits

Suppose that you would like the project to stop when a certain number of failures have occured. This is especially useful when running unattended tests, e.g. long running test or tests running from the command line. Such limits are configured by clicking the Set Limit button, residing in the playback panel.


Just set Failure limit to a reasonable number (in this tutorial, we wanted no more than 30 failures).


Immediately when the limit is reached, LoadUI will stop all VU Generators and the test will soon complete.