Is there something different about how Espresso runs tests after the first one when using parameterised tests?
I have two parameters and they both run just fine if I do them on their own (if I comment one of them out and just have one parameter), or if I reverse the order the first one always passes.
But for some reason when I run them together the second one always fails. Actually, one time it didn't fail. Without changing anything it worked one time. But just once. So it's possible maybe there's a bug but I'm inclined to think it's something I'm doing (or not doing).
The actual problem that occurs is that a field gets set to null halfway through the test (according to the debugger). But I can't seem to figure out how or why, especially since it doesn't happen on the first test. So I can't find anything obvious in the code that's doing it, but I also can't see what's different with Espresso either. Any ideas?
I've followed the debugger where it proved to me that the value is set, and then for some reason when it pauses the current Activity to launch a dialog the value gets set to null. But only on the second test. In this exact same situation on the first test it doesn't do that. Why?
Edit: Ok I've narrowed it down further but still not sure why it's doing this. It's a bit strange but I've discovered through the debugger, that onDetach in the first test is being called after onResume for the second test. Why might that be?
Anyway that's definitely why I'm having a problem as the code that's making the value null originates from onDetach, and the value is originally set from a method in onResume. So that explains it. But why is this happening?
Issue logged here: https://code.google.com/p/android/issues/detail?id=235247