Knowledgebase

Backend Testing Strategy Print

  • backenddevelopment, backend, database, performance, guide, howto, solution, zillionkinghost
  • 0

Verifying server code.

WHAT TO TEST AT EACH LEVEL

  • Unit: business rules, without infrastructure
  • Integration: the application with a real database
  • End to end: complete paths through the system

WHAT PROPORTION

Many unit tests, fewer integration, few end to end.

WHY

Unit tests are fast and precise; end-to-end tests are slow and fragile.

WHAT TO TEST WITH A REAL DATABASE

Anything involving queries.

WHY

Substituted databases do not reproduce real behaviour, and query faults are exactly what you need to catch.

WHAT TO SUBSTITUTE

External services, so tests do not depend on them.

WHAT TO TEST FOR EVERY ENDPOINT

The success path Invalid input Missing authentication Insufficient authorisation Not found

WHY THOSE LAST THREE

They are the paths most often broken and least often tested.

WHAT TO ENSURE

That tests are independent and can run in any order.

WHAT TO DO ABOUT TEST DATA

Create what each test needs, and clean up.

WHAT TO RUN AUTOMATICALLY

Everything, on every change.

WHAT A FLAKY TEST MEANS

Something is wrong. Investigate rather than rerunning.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot