Skip to content

Commit 4b74091

Browse files
committed
[test] Allow re-run of failed tests (fully filtered test suite, reactor#1139)
This commit prevents test failure when no tests are found due to a too restrictive filter. This will notably happen when failed tests are re-run from the IDE, leading to an enumeration of the tests to run that won't match the includes of additional test tasks like testNG. Additionally, a small test report is printed for each test task, giving status of the intermediate states of the global check task.
1 parent 8d6112e commit 4b74091

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ configure(subprojects) { p ->
174174
include '**/*Tests.*'
175175
include '**/*Test.*'
176176
include '**/*Spec.*'
177-
178177
}
179178

180179
//all test tasks will show FAILED/PASSED for each test method,
@@ -194,6 +193,17 @@ configure(subprojects) { p ->
194193
scanForTestClasses = false
195194
exclude '**/*Abstract*.*'
196195
exclude '**/*OperatorTest*.*'
196+
197+
//allow re-run of failed tests only without special test tasks failing
198+
// because the filter is too restrictive
199+
filter.setFailOnNoMatchingTests(false)
200+
201+
//display intermediate results for special test tasks
202+
afterSuite { desc, result ->
203+
if (!desc.parent) { // will match the outermost suite
204+
println('\n' + "${desc} Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
205+
}
206+
}
197207
}
198208

199209
// now that kotlin-gradle-plugin 1.1.60 is out with fix for https://youtrack.jetbrains.com/issue/KT-17564

0 commit comments

Comments
 (0)