Demo: Testcontainers integration tests for Shop
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
add real-database tests for Shop. Prepares JNR-045-LAB1.
Draft outline details
Step by step
- Add Testcontainers and the PostgreSQL module dependencies (verify versions).
- Create a shared base configuration with a
staticcontainer and@ServiceConnection. - Write a
@DataJpaTestfor a custom product search query. - Write a
@SpringBootTestthat creates an order and reads it back with migrations applied. - Planned mistake: an H2 test passes but the same query fails on PostgreSQL because of a function difference; move it to the Testcontainers test.
- Run the suite with Docker only, on a clean checkout.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.