android - Random Espresso Tests Failing -


i have test class in have 6 espresso tests. if run test class, 3 pass, 3 fail.

if run each test individually tests pass expected. of these have race conditions (api request) understand , im looking @ using idlingresource, others not, example there's nomatchingviewexception android.support.test.espresso.nomatchingviewexception: no views in hierarchy found matching: text: "sort best match" incorrect view there , found when test run on it's own, passes expected.

i'm wondering has come across , if share how fix it.

  • make sure reset app-state if 1 of tests making changes , second test relying on vanilla state. can use @before , @after annotations set/reset app state

  • check race-conditions , async processes in app

  • on slow test devices perform(click()) can result in longpress-action: android espresso performs longclick instead of click

i found pretty summary of reasons , fixes here: https://semaphoreci.com/community/tutorials/how-to-deal-with-and-eliminate-flaky-tests

i stumbled upon thread cause struggeling randomly failing tests, seem not have of mentioned reasons.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -