Saturday, October 27, 2018

Gradle tasks as before-launch tasks won't stop TestNG if they fail

An Android Studio project I'm involved in uses a TestNG run configuration to run some tests. To make sure the tests operate on the newest version of the code, the run configuration has Gradle run a "build" task first to compile just the one module we test. We've noticed that even if the Gradle-induced build fails, the test suite goes ahead trying to test whatever compiled artifacts are around and Android Studio switches to the Test tab in the output pane, making it difficult to see that something strange is going on. I have not found a way around this that only compiles a specific module, but if that wasn't a concern, using a Build before-launch task would be fine.

No comments:

Post a Comment