What is the purpose of JUnit 5 @Nested annotation

In JUnit 5 there is a new abstract: @Nested.

I understand how this works, I understand why we use a nested class, I just donโ€™t understand why we need to have a nested test class in our test.

+4
source share
2 answers

Annotation @Nestedallows you to have an inner class, which is essentially a test class, allowing you to group several test classes under the same parent (with the same initialization).

+6
source

. "" , . "", .

. , .

@Nested , .

Ruby. Java Junit 4 hirarchicalcontextrunner. . https://github.com/bechte/junit-hierarchicalcontextrunner/wiki.

0

All Articles