Decide pass or fail with checks

The check types, operators and result paths a test can check.

In short

Checks decide whether a test passes: a row count, a cell value, an error raised and more. A run with checks passes when all of them pass; a run without checks passes when the server raised no error.

Before you start

Add a check

  1. Open the test in the editor.
  2. Press "Add check" and choose the check type, or click a cell in a result grid to add a Cell value check for it.
  3. Choose an operator and the expected value. For a cell or a column, write the path (see below).
  4. Press "Save test" and run it.

Take a suggested check

  1. In the test editor, press "Run now". The answer shows under the editor; nothing is saved yet.
  2. Read "Suggested checks" under the answer: checks this run would pass, read from its answer only.
  3. Press "Add" on a line, or "Add all", and the check joins the test's checks. A check the test already has is not suggested again.
  4. Want more? Press "Draft checks with AI". AI reads only the column names, types and row count of this answer, never a value, and proposes checks you add the same way.
  5. Press "Save test".

The checks

Operators: equals, does not equal, greater than, at least, less than, at most, contains, does not contain, matches regex, exists and does not exist. Numbers compare as numbers.

Paths

A path addresses part of a result as $[set][row].Column. Both indexes start at 0 and default to 0, so $.Total is the Total column of the first row of the first result set. Clicking a cell writes the path for you.

Good to know

Example dbo.CreateInvoice must reject a negative amount. Run it with Amount -5 and it fails with a constraint violation - the right outcome. Save it as a test with an Error raised check expecting must be positive, and it passes. Duplicate it with Amount 120 and No error to prove both sides. Both roll back, so no invoice is left behind.

If something goes wrong

Related