Does a semi-parallel espresso test fail on static objects?

I am trying to use espresso and junit4. The problem is that I have code that is statically initialized in activity.on Creating and de-initializing in activity.onDestroy

Now, when I run espresso, the tests seem to work in "parallel." I added a log class to the onCreate and onDestroy actions.

What i see

onCreate = example.package.MainActivity@ABC onCreate = example.package.MainActivity@JKL onDestroy = example.package.MainActivity@ABC onCreate = example.package.MainActivity@XYZ onDestroy = example.package.MainActivity@JKL onDestroy = example.package.MainActivity@XYZ 

, and of course, it fails in NPE in the third test, because the second onDestroy test ran after the third onCreate (which removed the static code)

Is this normal behavior? Can I force an espresso to start an activity instance and then start a new one? Thanks!

+7
android junit4 android-testing android-espresso
source share

No one has answered this question yet.

See related questions:

55
Android Application Class Life Cycle
25
Espresso Hold Test
17
receiving a dagger to introduce false objects while performing functional testing espresso for Android
6
Espresso UI tests run on a single test, but crash on a test suite
6
Espresso does not wait until the activity is destroyed before creating a new one for the next test
4
Can I run Android Espresso unit tests in annotated @BeforeClass methods?
one
Espresso Test Does Not Match TextView Text
one
Why is IdlingResource null in Espresso tests in Android API 22?
0
Realm not working in Android Espresso test
0
Espresso test and mocking dataSource fails

All Articles