xpipe/gradle/gradle_scripts/junit.gradle
crschnick 3e7fbe89ac Merge branch prefs into master
The changes have been squashed as the commit history and messages were not very carefully crafted. There isn't that much value in preserving random commit messages.

Also due to diverging branches, rebasing or merging it was difficult.
2024-02-28 07:36:31 +00:00

39 lines
1.4 KiB
Groovy

import org.gradle.api.tasks.testing.logging.TestLogEvent
dependencies {
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
tasks.withType(Test) {
jvmArgs += ["-Xmx2g"]
useJUnitPlatform()
testLogging {
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STARTED
exceptionFormat = 'full'
showExceptions = true
showCauses true
showStandardStreams = true
}
outputs.upToDateWhen {false}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}