feat(backcore): Quarkus tests

Added quarkus test compatability with sonar through jacoco reporter
This commit is contained in:
LQ63
2026-04-13 16:57:33 +02:00
parent acddd58ad3
commit 2c4d96e373
5 changed files with 28 additions and 3 deletions
+1
View File
@@ -11,6 +11,7 @@
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/modules" />
<option value="$PROJECT_DIR$/modules/api" />
<option value="$PROJECT_DIR$/modules/backcore" />
<option value="$PROJECT_DIR$/modules/core" />
<option value="$PROJECT_DIR$/modules/io" />
<option value="$PROJECT_DIR$/modules/rule" />
+1 -1
View File
@@ -5,7 +5,7 @@
<option name="deprecationWarnings" value="true" />
<option name="uncheckedWarnings" value="true" />
</profile>
<profile name="Gradle 2" modules="NowChessSystems.modules.core.main,NowChessSystems.modules.core.scoverage,NowChessSystems.modules.core.test,NowChessSystems.modules.io.main,NowChessSystems.modules.io.scoverage,NowChessSystems.modules.io.test,NowChessSystems.modules.rule.main,NowChessSystems.modules.rule.scoverage,NowChessSystems.modules.rule.test,NowChessSystems.modules.ui.main,NowChessSystems.modules.ui.scoverage,NowChessSystems.modules.ui.test">
<profile name="Gradle 2" modules="NowChessSystems.modules.backcore.integrationTest,NowChessSystems.modules.backcore.main,NowChessSystems.modules.backcore.native-test,NowChessSystems.modules.backcore.quarkus-generated-sources,NowChessSystems.modules.backcore.quarkus-test-generated-sources,NowChessSystems.modules.backcore.scoverage,NowChessSystems.modules.backcore.test,NowChessSystems.modules.core.main,NowChessSystems.modules.core.scoverage,NowChessSystems.modules.core.test,NowChessSystems.modules.io.main,NowChessSystems.modules.io.scoverage,NowChessSystems.modules.io.test,NowChessSystems.modules.rule.main,NowChessSystems.modules.rule.scoverage,NowChessSystems.modules.rule.test,NowChessSystems.modules.ui.main,NowChessSystems.modules.ui.scoverage,NowChessSystems.modules.ui.test">
<option name="deprecationWarnings" value="true" />
<option name="uncheckedWarnings" value="true" />
<parameters>
+8
View File
@@ -21,7 +21,15 @@ sonar {
if (report.exists()) report.absolutePath else null
}.joinToString(",")
val jacocoReports = subprojects.mapNotNull { subproject ->
val report = subproject.file("build/reports/jacoco/test/jacocoTestReport.xml")
if (report.exists()) report.absolutePath else null
}.joinToString(",")
property("sonar.scala.coverage.reportPaths", scoverageReports)
if (jacocoReports.isNotEmpty()) {
property("sonar.coverage.jacoco.xmlReportPaths", jacocoReports)
}
}
}
+15 -2
View File
@@ -2,6 +2,7 @@ plugins {
id("scala")
id("org.scoverage") version "8.1"
id("io.quarkus")
id("jacoco")
}
@Suppress("UNCHECKED_CAST")
@@ -47,6 +48,7 @@ dependencies {
testImplementation("org.scalatest:scalatest_3:${versions["SCALATEST"]!!}")
testImplementation("co.helmethair:scalatest-junit-runner:${versions["SCALATEST_JUNIT"]!!}")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.quarkus:quarkus-jacoco")
testImplementation("io.rest-assured:rest-assured")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
@@ -81,8 +83,19 @@ tasks.test {
testLogging {
events("passed", "skipped", "failed")
}
finalizedBy(tasks.reportScoverage)
finalizedBy(tasks.named("jacocoTestReport"))
}
tasks.reportScoverage {
tasks.jacocoTestReport {
dependsOn(tasks.test)
executionData.setFrom(layout.buildDirectory.file("jacoco-quarkus.exec"))
sourceDirectories.setFrom(files("src/main/scala"))
classDirectories.setFrom(files(layout.buildDirectory.dir("classes/scala/main")))
reports {
xml.required.set(true)
xml.outputLocation.set(
layout.buildDirectory.file("reports/jacoco/test/jacocoTestReport.xml")
)
html.required.set(false)
}
}
@@ -1,3 +1,6 @@
quarkus:
http:
port: 8080
jacoco:
data-file: ${user.dir}/build/jacoco-quarkus.exec
report: false