@Retention(value=RUNTIME) public @interface Order
OrderedRunner JUnit runner. This allows to control the
ordering of tests in a test class.
public class MyTest {
@Test
public void test1() {
...
}
@Test
public void test2() {
...
}
nothing prevents the tests to be executed in the order test2() then test1(). To ensure that
the order will be test1() then test2(), you can use:
@RunWith(OrderedRunner.class)
public class MyTest {
@Test
@Order(order=1)
public void test1() {
...
}
@Test
@Order(order=2)
public void test2() {
...
}
| Modifier and Type | Required Element and Description |
|---|---|
int |
order
The order in which the method must be run.
|