All areas

Automation

Building automated tests that are fast, reliable and worth maintaining.

Essentialschecklist

  • Follow the test pyramid: more unit tests, then integration tests, fewer UI tests
  • Get your confidence from the tests in the code: they're fast, light and cheap
  • Keep each test short and focused so it doesn't become flaky
  • Keep suite run times short: the longer they run, the more maintenance they need

Where it fits

Testing section 🧪
  1. 01Refine
  2. 02Design
  3. 03Development
  4. 04Test
  5. 05Release

The Test Pyramid

▲ Fewer UI tests · slower · costly1Tests in the code2API tests3UI tests▼ More tests in the code · faster · cheaper
  1. 1

    Tests in the code

    Most of the coverage lives in the code itself.

    • Unit tests for each function and rule: cheap and fast to run, they give early confidence you're on the right path to good quality standards
    • Integration tests to confirm the service works correctly with its dependencies, such as its database and other internal services
    • Mocked functional tests for whole features without real services
  2. 2

    API tests

    Validate the APIs on a real environment.

    • Check status codes, error codes and error messages, not just 200 OK
    • Assert on the response body: fields, values and data types
    • Check authentication: missing, expired and wrong-role tokens
  3. 3

    UI tests

    A few end-to-end tests that give confidence the whole application works, front end and back end: the main flow, critical paths and regulatory requirements.

    • Keep tests short and specific so they don't become flaky
    • Create readable, minimal data for each scenario
    • Keep the suite under a set run time: the longer it runs, the more maintenance it needs
    • Stay lightweight

💡 Get your confidence from the tests in the code: they're lightweight, fast and cheap to run. That's why the test pyramid works. UI tests are our end-to-end sanity checks that the whole app works, front end and back end.