Level 1 · Apprentice0 XP
Fast tests for rules, sliced tests for the web and data layers, and a few full tests with a real database.
Step 1 / 5
ProblemEvery test starts the whole application and an in-memory database that behaves differently from production. The suite takes ten minutes, so nobody runs it before pushing, and a query that works in H2 fails in PostgreSQL.
← → step
Before this: Database migrations with Flyway
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.For one feature write a test at each level: a unit test of the service with a fake repository and no Spring, a @WebMvcTest for the controller's validation, and a @DataJpaTest with Testcontainers for one query. Time each and write the three numbers down.