Force rerun of a single test


(Jon Hill) #1

i have a multiproject build with a dozen java subprojects. Ive kicked off “gradle test” to run all the unit tests. At the end I can see 1 test has failed so I want to re-run this test with -i so I can check info logging output in the console.

gradle -i -Dtest.single=MyFailingTest test

tells me “test is up to date”

gradle -i --rerun-tasks -Dtest.single=MyFailingTest test

recompiles all the projects

gradle -i -Dtest.single=MyFailingTest testClean test

works, but will wipe all my successful test reports - not what i want

ive tried to create a task something like

task forceRunTest << {

test.outputs.upToDateWhen { false }

tasks.test.execute() }

but this seems to fail.

Whats the correct solution to force a single failing test to re-run ?

thanks

Jon