I have been trying to run espresso tests using AndroidJunit4
runner. Here is my Test Class.
@RunWith(AndroidJUnit4.class)
public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity> {
public MyActivityTest() {
super(MyActivity.class);
}
@Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
getActivity();
}
@Test
public void shouldAssert() {
onView(withId(someId)).check(matches(isDisplayed()));
}
}
I have been trying to run this test via ./gradlew connectedCheck
from command line but for some reason it does not recognize this test.
I am able to run this test via Android Studio though.
If I rename my test method from shouldAssert
to testShouldAssert
gradle is able to recognize this as a test and runs it successfully.
I am puzzled since in Junit4 style test method names need not start with test.
Anybody has any idea about this?
Aucun commentaire:
Enregistrer un commentaire