Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DirtiesContext does not clean up context properly #35318

Open
Labels
in: testIssues in the test module status: waiting-for-triageAn issue we've not yet triaged or decided on
@maxhov

Description

I am having trouble getting consecutive tests with clean contexts to work and I am not sure what I am doing wrong here. I suspect that the context is not cleaned properly.

When running multiple tests consecutively, the context of the previous test does not seem to be cleaned up properly when using @DirtiesContext(classMode = ClassMode.BEFORE_CLASS). In my particular case, I am running some tests with a @EnableJpaAuditing configured and some without. Running tests individually, they all pass, but running them together in a certain order, they influence eachother. I would expect the context to be clean for the entire test class when using @DirtiesContext(classMode = ClassMode.BEFORE_CLASS).

I created a reproducer here: https://github.com/maxhov/dirties-context/blob/master/src/test/java/com/example/dirtiescontext/DirtiesContextTest.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test module status: waiting-for-triageAn issue we've not yet triaged or decided on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /