Module · Backend Engineer
Testing Backend Code
The test pyramid, the database that lies to you, and the load you have to survive.
TOPIC 01
The Test Layers
Fast unit tests, honest integration tests, and the e2e suite you keep small.
What you'll practice
- Define the Test Layers — guided · beginner
- Make the Database Testable — practice · intermediate
A command you'll meet
cat ~/tests/strategy.mdTests are the cheapest way to change code safely. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Define the Test Layers
Unit, integration and end-to-end tests answer different questions and cost different amounts. Write what each layer covers in your service.
Make the Database Testable
Integration tests fail for boring reasons - a leftover row, a migration that did not run. Write the database strategy that removes them.
TOPIC 02
Contracts & Load
What the consumers promise, and what the service has to survive.
What you'll practice
- Write the Contract Rules — practice · intermediate
- Define the Load You Must Survive — challenge · advanced
A command you'll meet
cat ~/tests/load.yamlA contract is a promise between teams. Open the task below for the full walkthrough.
Hands-On Tasks in This Topic (2)
Write the Contract Rules
When two teams own the same endpoint, the contract is the test. Write the rules for consumer-driven contracts.
Define the Load You Must Survive
Performance is a requirement, not a hope. Write the load profile the service has to hold and the thresholds that fail the build.