Debug test

I have a problem in my test test (for which I use Robotium), so I decided to debug it. Usually I run a test from the command line using gradlew connectedAndroidTest , but it also runs from Android Studio (v0.8.14), choosing a specific gradle task. However, if I try to debug this gradle task, I get the error Unable to open debugger port : java.net.SocketException "socket closed" , and the test continues to work (without debugging). Is there any other way to debug a measurement test (with IDE) or am I missing something in my setup?

Update: However, it works on an emulator!

enter image description here

+5
source share
1 answer

I had the same problem. You just run tests incorrectly. Instead of clicking “debug” in the gradle task “connectedAndroidTest”, go to “Edit startup settings” in Android Studio. Click the plus sign and add the new Android Tests configuration. Then select the module where your tests are located (possibly the main module of your application) and save the configuration. Click "debug" on the newly created configuration.

+4
source

Source: https://habr.com/ru/post/1206100/


All Articles