Full-application tests
On This Lesson 4 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
run the whole application and test it end to end.
Planned topics
@SpringBootTeststarts the full context; withwebEnvironment = RANDOM_PORTit also starts the web server.- Flyway or Liquibase migrations run on the container database, so you test the real schema.
- Use
TestRestTemplateorWebTestClient; the next module adds REST Assured. - Keep the number of these tests small; each costs startup time.
- Cache the Spring context by keeping test configurations identical.
Draft outline details
Demonstration
a test that posts an order, then reads it back through the repository, with Flyway having created the tables.
Check your understanding
What does RANDOM_PORT avoid?
Show answer
Port clashes when tests run in parallel or on a busy machine.
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.