9

I am not able to debug android Instrumentation test cases (using espresso & UiAutomator)

But earlier test cases the debugging was working fine but with recent update it is not working anymore. It gets always struck up at instantiating unit test enter image description here

I can see in command window that it's trying to launch PACKAGE_NAME**.test**

 adb shell am instrument -w -r   -e debug true -e class PACKAGE_NAME.LanguageScreenTest#testSelectImportant PACKAGE_NAME**.test**/android.support.test.runner.AndroidJUnitRunner
zapping
  • 4,118
  • 6
  • 38
  • 56
Ankur
  • 429
  • 4
  • 10
  • Did you try doing 'Invalidate Caches / Restart' ? – Aram Tchekrekjian Aug 21 '16 at 08:08
  • Yes I did tried 'Invalidate Caches / Restart' and removing the updated version of studio with older version also did not seems to work (also removed there associated files in system) – Ankur Aug 23 '16 at 11:16

3 Answers3

2

The same thing for me in case i use AndroidOrchestrator. Turn it off if you dont really need to run the tests with it or, at least, when you want to debug.

(It has been so long time but just for the others who may fall latterly into this problem)

Phạm Lam
  • 378
  • 1
  • 3
  • 14
2

As @PhạmLam mentioned, turning off Android Test Orchestrator worked for me.

To "turn off", I just comment out the execution 'ANDROIDX_TEST_ORCHESTRATOR' line in build.gradle when I want to debug:

...
android {
  defaultConfig {
   ...
   testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   testInstrumentationRunnerArguments clearPackageData: 'true'
 }

  testOptions {
    // Comment out below line
    // execution 'ANDROIDX_TEST_ORCHESTRATOR'
  }
}
...
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
0

The problem is with some config file which is not tracked in git (so not able to figure out right now, Will do it when have free time)

adb shell am instrument -w -r -e debug true -e class PACKAGE_NAME.LanguageScreenTest#testSelectImportant PACKAGE_NAME**.test**/android.support.test.runner.AndroidJUnitRunner

when debug parameter is true test cases do not work in debug mode and it will struck on above state

but when this parameter is false it works

To solve this problem I have to use another clone of same repository (I had also tried deleting .idea and .gradle in same workspace which did not worked for me)

Ankur
  • 429
  • 4
  • 10