Skip to content

Add @DirtiesContext mode to dirty context after top-level test class for @Nested test classes #28304

Open
@jmarchionatto

Description

@jmarchionatto

When running tests using @DirtiesContext and a test class includes multiple @Nested classes, the context is dirtied and refreshed after each nested class, even when using the coarsest mode possible level (ClassMode.AFTER_CLASS).

There is currently no way to specify that @DirtiesContext should only dirty the context after the top-level class but not after each nested class.

A ClassMode.AFTER_MAIN_CLASS is suggested to specify the desired functionality.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions