Home » Android » unit testing – Android Studio Tests are successful but do not stop junit

unit testing – Android Studio Tests are successful but do not stop junit

Posted by: admin June 15, 2020 Leave a comment

Questions:

I am new to Android and building an app in Android Studio. I have written some tests using JUnit and Mockito.

The tests run successfully and in the run console the text Process finished with exit code 0 is shown.

However, the thread seems to remain active, the stop button is enabled and nothing happens even if I click on it. If I try to start multiple test configurations, they all remain active although the processes finish successfully.

I hope the question is clear enough… I have searched a lot for the answer and mananged to find nothing.

How to&Answers:

Ok, so after a little more research and some more checking I have concluded that the problem stands in a visual bug of Android Studio. Apparently the tests do indeed stop, the thread running them too. The problem is purely visual.

Answer:

That can be fixed by following these steps:

  1. Open ‘Run’ tab in Android Studio
  2. Tap ‘X’ next to test which has just passed

Android Studio Guide