Issue
Here is the code :
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
class TCSix {
@BeforeAll
static void setUpBeforeClass() throws Exception {
}
@AfterAll
static void tearDownAfterClass() throws Exception {
}
@Test
void aTestBlankEmailValidation() {
fail("Not yet implemented");
}
@Test
void bTestRegistrationORLogin() {
fail("Not yet implemented");
}
}
Here the bTestRegistrationORLogin()
will run first in place of aTestBlankEmailValidation()
, where as I declared FixMethodOrder
on top.
Solution
It is recommended that test methods be written so that they are independent of the order that they are executed
However, for your case, make sure two things:
- JUnit version is more than 4.11
- JUnit is not 5 , cause there the annotation is not supported yet
Answered By - BigGinDaHouse
Answer Checked By - Mildred Charles (JavaFixing Admin)