Package org.junit.jupiter.api
Annotation Type TestClassOrder
-
@Target(TYPE) @Retention(RUNTIME) @Documented @Inherited @API(status=EXPERIMENTAL, since="5.8") public @interface TestClassOrder
@TestClassOrder
is a type-level annotation that is used to configure aClassOrderer
for the@Nested
test classes of the annotated test class.If
@TestClassOrder
is not explicitly declared on a test class, inherited from a parent class, declared on a test interface implemented by a test class, or inherited from an enclosing class,@Nested
test classes will be executed in arbitrary order.As an alternative to
@TestClassOrder
, a globalClassOrderer
can be configured for the entire test suite via thejunit.jupiter.testclass.order.default
configuration parameter. See the User Guide for details. Note, however, that a@TestClassOrder
declaration always overrides a globalClassOrderer
.Example Usage
The following demonstrates how to guarantee that
@Nested
test classes are executed in the order specified via the@Order
annotation.@TestClassOrder(ClassOrderer.OrderAnnotation.class) class OrderedNestedTests { @Nested @Order(1) class PrimaryTests { // @Test methods ... } @Nested @Order(2) class SecondaryTests { // @Test methods ... } }
- Since:
- 5.8
- See Also:
ClassOrderer
,TestMethodOrder
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description java.lang.Class<? extends ClassOrderer>
value
TheClassOrderer
to use.
-
-
-
Element Detail
-
value
java.lang.Class<? extends ClassOrderer> value
TheClassOrderer
to use.
-
-