S SDDO Notes · IE BCSAI 2025
06 · Foundations

Testing

Tests are an executable specification. They are not about catching bugs — they're about enabling change. A codebase with bad tests is harder to refactor than one with no tests at all.

The test pyramid

Three layers, in inverse proportion to their cost:

Invert the pyramid (lots of slow E2E, few unit) and your suite takes 40 minutes, fails flakily, and gets disabled within a sprint.

Properties of good tests

FIRST:

Coverage as a floor

Line coverage measures "did this line run during tests?" — not "is this line correct?" A test that calls a function and asserts nothing has 100% coverage and zero value.

Treat coverage as a floor (the assignment requires 70%) and combine with:

Testing microservices

End-to-end is doubly painful across services: deploy 7 services, seed each, fail at step 5 because of a flaky DNS lookup. Instead:

See Microservices testing (sub-deck).

TDD as a tool, not a religion

Red → green → refactor. Useful when:

Less useful when:

"Coverage is the seatbelt, not the destination." High coverage is necessary but not sufficient — the question is whether your tests would catch a regression.

What to remember at exam time

Source · Slide deck
Testing — main deck (+ four supporting decks)
Open PDF