jeudi 30 juin 2016

Espresso freezing on some tests randomly

I have a couple of these pretty simple tests just to try out Espresso:

@Test(timeout = 3000)
public void testSomeButton()
{
    Espresso.onView(ViewMatchers.withId(R.id.someid)).perform(ViewActions.click());
    Matcher<Intent> intentMatcher = IntentMatchers.hasComponent(SomeActivity.class.getName());
    Intents.intended(intentMatcher);
}

The problem is, every now and then, Espresso freezes on a test. The yellow Spinner in Android Studio keeps spinning forever, and I can see that the screen on my Android device is just the default android home screen, meaning that the activity has not been launched. I also have some timeout for my test, so I guess this means that the test has not been started.

If it helps: - There are 10 tests similar to this (for different activities) in a class. - Sometimes after a couple of successful tests, it freezes on 6th one (for example), sometime it runs all of them fine

Aucun commentaire:

Enregistrer un commentaire