j2emanue j2emanue - 3 months ago 19
Android Question

Android - what is gradle task connectedCheck used for

When I run the following command I get a description of

connectedCheck
but I'm still not sure what it's used for. Could anyone give me a real world example?

./gradlew tasks prints

...
Verification tasks
------------------
check - Runs all checks.
connectedCheck - Runs all device checks on currently connected devices.
connectedInstrumentTest - Installs and runs the tests for Build 'Debug' on connected devices.
deviceCheck - Runs all device checks using Device Providers and Test Servers.
...

Answer

Command ./gradlew connectedCheck executes unit tests located in src/androidTests/ directory on connected Android device or emulator. Such tests can have dependencies to Android API. These tests can be simple assertions or UI tests with Espresso framework or something similar. Yesterday I wrote post about Android automated tests including more detailed description of them. You can check it out here: http://stackoverflow.com/a/31975806/1150795.