So, for such tests, where these steps depend on each other, you should really execute them as one unit. You really should do something like:
@Test public void registerWelcomeAndQuestionnaireUserTest(){
As @Jeremiah mentions below, there are several unique ways that individual tests can run unpredictably.
Now that I have said this, here is your solution.
If you need separate tests, you can use @FixMethodOrder and then do it with NAME_ASCENDING . This is the only way I know.
@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestMethodOrder { @Test public void testA() { System.out.println("first"); } @Test public void testC() { System.out.println("third"); } @Test public void testB() { System.out.println("second"); } }
will execute:
testA(), testB(), testC()
In your case:
@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class ThisTestsEverything{ @Test public void T1_registerUser(){
Jared hooper
source share