I have a flaky junit test that only fails if I run all my tests. I think that one test is causing another test to fail, I want to prove it before I try to fix it.
I
As said by Ali Dehghani, You can order the test method execution by
@FixMethodOrder(MethodSorters.NAME_ASCENDING): Sorts the test methods by method name, in lexicographic order.
Code:
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ApplicationTest extends ActivityInstrumentationTestCase2 {
public ApplicationTest() {
super(MainActivity.class);
}
@Rule
public ActivityTestRule mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
void t1AttachUI(){
// testing code goes here
}
@Test
void t2InitializeViews(){
// testing code goes here
};
@Test
void t3SettingValues(){
// testing code goes here
};
@Test
void t4Validation(){
// testing code goes here
};
@Test
void t3AfterButtonPress(){
// testing code goes here
};
}