2023-01-27 02:34:46 +00:00
|
|
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
testImplementation 'org.hamcrest:hamcrest:2.2'
|
2024-07-21 22:47:10 +00:00
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.3'
|
|
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
|
2023-01-27 02:34:46 +00:00
|
|
|
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(Test) {
|
2024-02-28 07:36:31 +00:00
|
|
|
jvmArgs += ["-Xmx2g"]
|
2023-01-27 02:34:46 +00:00
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events TestLogEvent.FAILED,
|
|
|
|
TestLogEvent.PASSED,
|
|
|
|
TestLogEvent.SKIPPED,
|
2024-02-28 07:36:31 +00:00
|
|
|
TestLogEvent.STANDARD_OUT,
|
|
|
|
TestLogEvent.STANDARD_ERROR,
|
|
|
|
TestLogEvent.STARTED
|
2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
exceptionFormat = 'full'
|
|
|
|
showExceptions = true
|
|
|
|
showCauses true
|
|
|
|
showStandardStreams = true
|
|
|
|
}
|
|
|
|
|
2024-02-28 07:36:31 +00:00
|
|
|
outputs.upToDateWhen {false}
|
|
|
|
|
2023-01-27 02:34:46 +00:00
|
|
|
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))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|