I\'ve got an issue with testing my android application.
I have 2 testCase class, if I execute them separately, there is no problem, the tests run until the end. But if I
I also encountered similar problem when running my android instrumentation. Eventually i ended up with conclusion that the problem is of System.exit(0).
Now, the reason, why it causes the problem According to its documentation
Causes the VM to stop running and the program to exit.
When System.exit(0) gets executed all other code written after this code are skipped and activity class gets finalized and go for Garbage Collected. Since Instrumentation rely on activity life-cycle method, the activity class is Garbage collected the there is no chance of calling its methods if object itself does not exist.
Hence avoid using System.exit(0) if you want to do unit testing of application, use finish() method instead.