6

I am running Android instrumented tests using espresso.

I have a little more than 70 tests to be run which all click through different parts of my application.

When I run each test as a single test they all work and I get a green test result.

When I run them all at the same time (right click on the androidTest folder -> hit run) then some of them fail saying the view cannot be found.

In different runs different tests are failing. I think it might be that something is going too quickly here.

Do you guys have any suggestions on how to fix this? Thank you so much in advance!

TobHo
  • 73
  • 5

1 Answers1

1

in Setup your test environment section of Espresso setup instructions you have:

On your device, under Settings->Developer options disable the following 3 settings:

Window animation scale

Transition animation scale

Animator duration scale

animations may be related with your suspicion: something is going too quickly here

you may also use Thread.sleep(1000); (milliseconds) inside test methods for delaying some calls

anyway, without any code all above its just a guess...

Community
  • 1
  • 1
snachmsm
  • 17,866
  • 3
  • 32
  • 74
  • thanks. turning off animations did not do much. Inserting pauses helps to make it more stable. But not really 100%. It also makes my tests soooo slow. Can you hint me towards some kind of code that I can post that would help understand the project? Because how I see it I just have a lot of different UI tests each doing different things and crashing at different times. -> I will investigate further and see if I can find a pattern which tests exactly are failing and under what conditions. Thanks again! – TobHo Mar 23 '17 at 12:43