The problem is:
- There is an android application. I want to execute android instrumentation tests (The gradle task is connectedCheck).
- I want to open generated report in browser independently of whether were tests successfull or not.
Here the code of my task:
task showReportInBrowser << {
String resultsPath = projectDir.toString().replaceAll("\\\\", '/')
resultsPath = resultsPath + '/build/reports/androidTests/connected/index.html'
java.awt.Desktop.desktop.browse resultsPath.toURI()
}
I have tried this:
connectedCheck.finalizedBy showReportInBrowser
If the connectedCheck executes normally I get what I want. But if the connectedCheck fail, my showReportInBrowser doesn't execute.
I think this is because the connectedCheck task depends on the connectedDebugAndroidTest task, which is failed while execution, therefore the connectedCheck even doesn't start, and my showReportInBrowser does't start too.
So I tried this:
connectedDebugAndroidTest.finalizedBy showReportInBrowser
But gradle said: Error:(75, 0) Could not find property 'connectedDebugAndroidTest' on project ':app'. Open File
I don't understant: why the connectedCheck and connectedDebugAndroidTest are shown both in gradle verification group, but I can use in my buildscript only connectedCheck?
How can I reach my goal?