Skip to content
Ameen Abozaid
Planned lessonJNR-045-L07

Demo: fixing leaking test data

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

find and fix tests that depend on each other. Prepares JNR-045-LAB1.

Draft outline details

Step by step

  1. Show two tests that pass alone but one fails when run together.
  2. Find the cause: both insert the same email, or one counts all rows.
  3. Run in random order (JUnit method order setting) to reproduce.
  4. Fix with unique data per test and a cleanup in @BeforeEach.
  5. Planned mistake: adding @Transactional to a test that uses real HTTP and seeing the leak remain; explain why and use cleanup instead.
  6. Run the suite ten times to confirm.

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.

Type to search levels, phases, modules and lessons.