7

Issue:

I upgraded to Android Studio 2.0 from 1.5 yesterday on Ubuntu. When I unit-test in Android Studio 2.0, it shows Terminated test status even though all tests are passed. Sometimes it shows only some of the tests passed. I'm pretty sure my code is working and tests are correct, because I had same setup on Android Studio 1.5.

For example I have 22 tests. Sometimes it shows all 22 tests passed, on the next run it shows 21 of 22 tests passed, sometimes Stopped. 20 of 22 tests passed, other times it shows all 20 tests passed even though I have 22 test. It all happens randomly. No failure message is shown.

Tried solutions so far:

I found an answer about Android studio on a similar IntelliJ issue that turning off Instant Run to Hot Swap resolves the issue. But that didn't solve the problem.

I tried running tests in Android Studio 1.5 but no problems.

Has anyone encountered any such issues in Android Studio 2.0, did you find any fix for this? Any help is much appreciated. Thanks!

Community
  • 1
  • 1
Yogesh Umesh Vaity
  • 41,009
  • 21
  • 145
  • 105
  • Android Studio may be losing the connection to the device or emulator, whilst the test is running. Try to reset the connection before starting: `adb kill-server; adb start-server; adb devices`. See also: https://stackoverflow.com/questions/36675654/error-while-waiting-for-device-time-out-after-300seconds-waiting-for-emulator-t – Mr-IDE Mar 13 '20 at 17:37
  • Update the android studio. This problem occurs in a few releases. On a side note, if you don't want to apply a big update, you can view ignored updates too and update accordingly. – NullByte08 Apr 02 '20 at 03:11

2 Answers2

3

This sounds like a known bug. The description on the bug report does not indicate some test not being run occasionally though.[1] I am running into similar issues but all the tests are run.

There seems to be a fix on the way probably in Android Studio 2.1.

[1] https://code.google.com/p/android/issues/detail?id=201968

iisulop
  • 46
  • 4
1

I would like to confirm that Android Studio 2.1 has been released. I just updated to Android Studio 2.1 and Android Gradle plugin 2.1.0 and this issue has been fixed.

Yogesh Umesh Vaity
  • 41,009
  • 21
  • 145
  • 105
  • I have seen this issue (very rare though) in Android Studio 2.2.2. (Only happens for me when running the tests in debug mode.) – Adil Hussain Dec 03 '16 at 14:27