I have a gradle taskX
that I would like to run after connectedAndroidTest
task finishes, however only if all tests pass in connectedAndroidTest
.
How I can achieve this?
I have a gradle taskX
that I would like to run after connectedAndroidTest
task finishes, however only if all tests pass in connectedAndroidTest
.
How I can achieve this?
You need to utilize
finalizedBy
along with particular task's state checking. Here's how it can be done:Now if run with:
the output will be:
When:
is run, then the output is:
Here a demo can be found.
You're describing Task Dependencies. You can define a task that depends on another, and will therefore trigger the other when it is executed:
And then just run your task, and
connectedAndroidTest
will be execute first:Task Dependency docs