test: 統合テストをできるように

This commit is contained in:
usbharu 2023-11-09 17:48:48 +09:00
parent 4b6316074f
commit 8992ff1928
1 changed files with 32 additions and 1 deletions

View File

@ -27,6 +27,37 @@ apply {
group = "dev.usbharu" group = "dev.usbharu"
version = "0.0.1" version = "0.0.1"
sourceSets {
create("intTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}
val intTestImplementation by configurations.getting {
extendsFrom(configurations.implementation.get())
}
val intTestRuntimeOnly by configurations.getting {
extendsFrom(configurations.runtimeOnly.get())
}
val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"
testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath
shouldRunAfter("test")
useJUnitPlatform()
testLogging {
events("passed")
}
}
tasks.check { dependsOn(integrationTest) }
tasks.withType<Test> { tasks.withType<Test> {
useJUnitPlatform() useJUnitPlatform()
val cpus = Runtime.getRuntime().availableProcessors() val cpus = Runtime.getRuntime().availableProcessors()