Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are list of tasks that ConnectedAndroidTest executes?

I want to understand more about ConnectedAndroidTest Gradle task. I see that it is used to install the application and test apks and run the tests.

But what are the individual steps that it does? (gradle tasks if any)

"gradle build" seems to generate the Application apk. What task generates the test apk? And how does it(ConnectedAndroidTest) install the application and test apk? And how does it start the tests?

Thanks very much.

like image 407
ap1234 Avatar asked Jul 30 '15 00:07

ap1234


People also ask

What are Gradle tasks?

The work that Gradle can do on a project is defined by one or more tasks. A task represents some atomic piece of work which a build performs. This might be compiling some classes, creating a JAR, generating Javadoc, or publishing some archives to a repository.

Where are Gradle tasks?

To see which tasks are available for our build we can run Gradle with the command-line option -t or --tasks. Gradle outputs the available tasks from our build script. By default only the tasks which are dependencies on other tasks are shown. To see all tasks we must add the command-line option --all.

What does Gradle test do?

Gradle executes tests in a separate ('forked') JVM, isolated from the main build process. This prevents classpath pollution and excessive memory consumption for the build process. It also allows you to run the tests with different JVM arguments than the build is using.


1 Answers

To answer the more general question "what are the list of tasks that task <taskName> executes?", there are two simple ways to find that out for any given task.

The first is:

./gradlew tasks --all | grep <taskName> 

where <taskName> should be replaced with whatever task you care about. E.g., ./gradlew tasks --all | grep connectedDebugAndroidTest. Note that I'm piping through grep to save myself the trouble of manually sifting through the list of all tasks.

The second is:

Use the task-tree plugin. Once applied, usage looks like this:

./gradlew <taskName> taskTree

Or, as I usually prefer it:

./gradlew <taskName> taskTree --no-repeat -quiet

The latter option makes the output a bit less cluttered.

like image 73
AutonomousApps Avatar answered Nov 15 '22 19:11

AutonomousApps