Skip to content
Ameen Abozaid
Planned lessonJNR-045-L04

Full-application tests

  • Lesson 4 of 7
  • Junior
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

  • @SpringBootTest starts the full context; with webEnvironment = RANDOM_PORT it also starts the web server.
  • Flyway or Liquibase migrations run on the container database, so you test the real schema.
  • Use TestRestTemplate or WebTestClient; 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.