Wednesday, August 9, 2017

Android JUnit @BeforeClass flakiness for longer running routines

Using @BeforeClass in a JUnit test seems like a great way to make tests run more efficiently. Surely it's a natural place to put long-running setup routines!

Unfortunately, Android's test runner in Android Studio will, depending on how it feels, might run the next test, might skip the next test, might skip a couple more tests just for good measure, or it might just give up the tests entirely. Looking for an error message or a hint?