Getting Started with Assertions

PDF Print E-mail
User Rating: / 4  |  Rate this article: PoorBest 

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

Video Tutorial



0.1. Preparations

asserionsStarded1

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.2. 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.

asserionsDrag1

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.

asserionsCreationDialog1

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.

asserionsRename2

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

asserionsRename1

0.3. 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.

asserionsDragToChart1

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.

asserionsInChart

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.

asserionsEventLog1

0.4. 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.

asserionsSetLimits1

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

assertions_gettingStarted_setRunLimits

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

assertions_gettingStarted_projectStopped