Test suites that pick up new endpoints by rule

The trouble with hand-picked test suites is that they're frozen. The day you build one, it's complete. Every endpoint added after that is untested until someone remembers to add it.

A rule package doesn't freeze. It describes which requests belong, and the suite works it out again each time it runs.

Write a rule

Open a suite in Tests, then the By rule tab in the Requests panel:

  1. Pick the collection, and optionally a folder.
  2. Set any of: method, a piece of the URL, a piece of the name.
  3. Look at the match list, which shows the requests the rule takes right now.
  4. Add the package.

Rules worth having

Read-only smoke test. Every GET in the collection:

MethodURL containsName contains
GET

Safe to run against production, and it grows with the API.

One resource. Everything about invoices:

MethodURL containsName contains
any/invoices

One API version. When v2 is rolling out:

MethodURL containsName contains
any/v2/

A naming convention. If your team prefixes critical requests with [smoke] or Critical::

MethodURL containsName contains
anyCritical

A naming convention is the most flexible rule, because anyone can opt a request in by renaming it.

Checks on the package

Select the package card and add checks in the Edit panel. They apply to each request the rule takes, now and later. For a read-only smoke rule:

  • status is less than 400;
  • response time is less than 1500;
  • Content-Type contains json.

A request the rule picks up next month gets these checks on its first run.

Removing one request

If a matching request shouldn't run in this suite, remove it from the package. It's skipped in this suite only; restore brings it back. The rule itself doesn't change.

Rules, folders and hand-picked requests together

A suite can mix all of them:

  • a Setup step, hand-picked: log in;
  • a rule package: every GET;
  • a folder package: the Checkout folder, in order;
  • a Clean up step, hand-picked: delete the test user.

Order still matters: cards run left to right, and a package's requests run in the collection's order.

Watch the match list in reviews

Rules are only as good as the names and URLs they match. A request named "invoice list" won't match Invoice if the rule is case-sensitive in your habits, and a URL written as {{baseUrl}}/Invoices won't match /invoices. Look at the match list after big renames, and check the suite's coverage count (see finding untested endpoints).

In the CLI

Rules are worked out on every run, wherever it runs:

Terminal
requestarium run --suite "Billing/Smoke" --env Production --junit smoke.xml