Skip to content

Commit

Permalink
[test] Allow re-run of failed tests (fully filtered test suite, react…
Browse files Browse the repository at this point in the history
…or#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.
  • Loading branch information
simonbasle committed Mar 22, 2018
1 parent 8d6112e commit 4b74091
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ configure(subprojects) { p ->
include '**/*Tests.*'
include '**/*Test.*'
include '**/*Spec.*'

}

//all test tasks will show FAILED/PASSED for each test method,
Expand All @@ -194,6 +193,17 @@ configure(subprojects) { p ->
scanForTestClasses = false
exclude '**/*Abstract*.*'
exclude '**/*OperatorTest*.*'

//allow re-run of failed tests only without special test tasks failing
// because the filter is too restrictive
filter.setFailOnNoMatchingTests(false)

//display intermediate results for special test tasks
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println('\n' + "${desc} Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
}
}
}

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

0 comments on commit 4b74091

Please sign in to comment.