fbpx
Uncategorized

Advanced Expectations Setting For Performance Testing

Sometimes you run a performance test just to make sure your application works fine for different browsers or locations. But in other cases you may know exact thresholds for some metrics, that would show that application works as expected. In these cases using assert preconditions is a clever idea that can save you time and improve your testing. Assert values often can be dependent on different circumstances, such as different CPU usage based on browser versions, muted/unmuted video, etc. Assert preconditions are a set of conditions, which must be fulfilled before executing asserts for a participant. Preconditions not only give more flexibility and control over the assertion process but also provide advanced monitoring capabilities, making results more accurate by fine-tuning expectations for different participants in the test.

Note, that preconditions are directly related to asserts, so the asserts and their preconditions will be executed only if the test mode is set to “performance test”. For better understanding of how you can use various asserts in Loadero, we advise to read our blog post about post-run assertions and another about runtime assertions and also take a look at wiki page about asserts. Use of these features can bring great benefits to your testing, that is why we strongly recommend you to learn how to use them.

Configuration of assert preconditions

Assert preconditions can be configured while creating or editing the test. Here are simple steps to setup assert preconditions:

1. Navigate to “Asserts” tab while creating or editing the test

2. Edit existing assert by clicking on it or create a new one using “Add assert” button to bring up assert configuration window. Adding preconditions is optional for assert configuration and can be omitted, if not needed. Don’t forget about mandatory properties of the assert – “Path”, “Operator” and “Expected” (read more about asserts and their configuration in this blog article).

3. Select preferred preconditions from the predefined list using checkboxes and save the assert. Assert precondition evaluations are based on either equality or inequality of the corresponding property’s value. The following properties can be used to define assert preconditions:

  • Browser
  • Location
  • Media type
  • Network conditions

4. Once you click the “Save” button, all selected preconditions will show up in the corresponding column.

As you can see, the use of assert preconditions is not hard at all and you can set them in just four easy steps. But sometimes you can have a more complex test case, that requires more than just a single precondition. Loadero allows you that as well!

Precondition chaining

Multiple preconditions on the same assert are chained using logical AND operator. As seen in the example below, assert will be executed only if browser != chrome78 AND location == ap-northeast-2.

Be attentive when chaining multiple preconditions from the same property field, e.g.browser, as in some cases they can be contradicting. For example, preconditions chain browser == chrome78 AND browser == firefoxLatest will never be fulfilled, therefore assert will never be executed.

Chaining with OR

To implement chaining with OR operator, it is necessary to create duplicate asserts with appropriate preconditions. As seen in the example below, assert will be executed if location == ap-northeast-2 OR location == ap-south-1.

Assert preconditions – simple, yet powerful

Assert preconditions are a simple, yet powerful and very useful functionality to use. It brings a lot of flexibility and control over assertion for each test participant, especially, when it comes to complicated test scenarios with multiple flows and a lot of test participants. For example, gathering network statistics based on specific location or CPU and RAM usage assertion based on browser versions.

We hope the use of assertions will save you some precious time and help running effective tests. In case of any difficulties or uncertainties, remember that you can always contact our support team at support@loadero.com, we are here to help you.

Write A Comment