Learning path

Full curriculum

Full curriculum

Unit content

Automated software testing

Automated tests execute software in controlled situations and check observable results repeatedly. Their purpose is to protect behaviour that matters, not to preserve every detail of the current implementation.

Behaviour and regression

A useful test states a contract:

given a valid order
when it is accepted
then its production tasks become active

When a defect is fixed, a regression test can preserve the case that previously failed.

Test boundaries

A small test can exercise one function or module in isolation. An integration test exercises several real components together, such as application code with a database.

Use the narrowest boundary that can test the important behaviour faithfully. If correctness depends on a database constraint, parser, filesystem or external protocol, replacing that boundary with a mock may remove the very semantics that need testing.

Test doubles

Fakes, stubs and mocks can replace dependencies to make failures reproducible or to exercise difficult paths. They are most useful at meaningful boundaries; excessive mocking can turn a test into a check of private call sequences rather than useful behaviour.

Determinism and independence

Tests should control the inputs that affect their outcome and avoid depending accidentally on execution order, leftover state, current time or unrelated external services.

Valuable assertions

Prefer assertions about outputs, persisted state, errors or externally visible effects. Exact internal SQL text, private function order or incidental formatting usually makes tests fragile without protecting additional behaviour.

A maintainable test suite concentrates effort on important contracts, edge cases and plausible regressions.