Save a run as a test and run it again

Turn a Scratchpad run into a test, then run one test, a group or all of them from the Tests board.

In short

A test is a saved run your team can repeat. Save one from the Scratchpad, add checks, and run one test, a group or all of them from the Tests board. A test runs when someone presses Run, or on a schedule you set (see "Run on a schedule" below).

Before you start

Save a test

  1. In the Scratchpad, run a statement and press "Save as test". The editor opens with the SQL, parameters, environment and transaction filled in.
  2. Give it a name the team will recognize, such as Create invoice rejects a negative amount, and choose a "Test group".
  3. Add checks with "Add check", or run the test and click cells.
  4. Press "Save test". It shows as "Not tested" until its first run.

Run from the Tests board

  1. Press "Run" on a test, "Run group" on a test group, or "Run all tests" for the project.
  2. To pass values from one test to the next, open "More ways to run" beside "Run all tests" and choose "Run all in order (chained)".
  3. Run all tests, Run group and the chained run go to the background queue: their progress shows above the tests, and you can leave the screen while they run.
  4. To stop one, press "Cancel" on its progress line. It stops after the test in hand; what ran is kept, and the tests it did not run are not counted.
  5. When it ends, a message says how many passed and failed. Press "Show failing" to see only the failures.

Good to know

Find tests and keep views

See how the database runs a query

See the safety rules where you run

Change many tests at once

Run on a schedule

Gate a pipeline on the project

Your build pipeline can run the project and stop when a test fails. {{brand}} runs the tests on its own queue, against the environment the project keeps and under its safety rules - exactly like Run all tests - so no database address is in the pipeline.

Move tests with a file

  1. Open the Tests board's … menu and choose "Download cases file". Every case of the project is saved as one .sqlcases.json file named after the project.
  2. Keep the file in your repository, or edit it, or take it to another project or workspace.
  3. In the project that should get the tests, open the … menu, choose "Import tests file…" and pick the file.
  4. Read what the import would do: each test is New, Changed, Same or Skipped, with the reason for a skipped one. Nothing is written yet.
  5. Press "Import n tests".

If something goes wrong

Related