You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce support for ordering the sequence of test methods
These commits introduce new support in JUnit Jupiter for ordering the
sequence of test methods.
Specifically, these commits introduce a new MethodOrderer API that can
be registered via a new @TestMethodOrder annotation.
JUnit Jupiter provides the following built-in implementations of this
new API.
- Alphanumeric: sorts test methods alphanumerically based on their
names and formal parameter lists.
- OrderAnnotation: sorts test methods numerically based on values
specified via the @order annotation.
- Random: orders test methods pseudo-randomly and supports
configuration of a custom seed.
Consult the new "Test Execution Order" section of the User Guide for
details and example usage.
Issue: #13
Copy file name to clipboardExpand all lines: documentation/src/docs/asciidoc/user-guide/writing-tests.adoc
+39-1
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,9 @@ module.
24
24
| `@ParameterizedTest` | Denotes that a method is a <<writing-tests-parameterized-tests, parameterized test>>. Such methods are _inherited_ unless they are _overridden_.
25
25
| `@RepeatedTest` | Denotes that a method is a test template for a <<writing-tests-repeated-tests, repeated test>>. Such methods are _inherited_ unless they are _overridden_.
26
26
| `@TestFactory` | Denotes that a method is a test factory for <<writing-tests-dynamic-tests, dynamic tests>>. Such methods are _inherited_ unless they are _overridden_.
27
-
| `@TestInstance` | Used to configure the <<writing-tests-test-instance-lifecycle, test instance lifecycle>> for the annotated test class. Such annotations are _inherited_.
28
27
| `@TestTemplate` | Denotes that a method is a <<writing-tests-test-templates, template for test cases>> designed to be invoked multiple times depending on the number of invocation contexts returned by the registered <<extensions-test-templates, providers>>. Such methods are _inherited_ unless they are _overridden_.
28
+
| `@TestMethodOrder` | Used to configure the <<writing-tests-test-execution-order, test method execution order>> for the annotated test class; similar to JUnit 4's `@FixMethodOrder`. Such annotations are _inherited_.
29
+
| `@TestInstance` | Used to configure the <<writing-tests-test-instance-lifecycle, test instance lifecycle>> for the annotated test class. Such annotations are _inherited_.
29
30
| `@DisplayName` | Declares a custom display name for the test class or test method. Such annotations are not _inherited_.
30
31
| `@DisplayNameGeneration` | Declares a custom display name generator for the test class. Such annotations are _inherited_.
31
32
| `@BeforeEach` | Denotes that the annotated method should be executed _before_ *each* `@Test`, `@RepeatedTest`, `@ParameterizedTest`, or `@TestFactory` method in the current class; analogous to JUnit 4's `@Before`. Such methods are _inherited_ unless they are _overridden_.
@@ -363,6 +364,43 @@ characters have been removed.
0 commit comments