Skip to content

Commit

Permalink
[ESWE-1181] Refactor tests (#11)
Browse files Browse the repository at this point in the history
- split tests into `test` (unit tests) and `integrationTest`
(integration tests)
- extract `integrationTest` (via of `jvm-test-suite` plugin)
  • Loading branch information
rickchoijd authored Jan 20, 2025
1 parent cbcd011 commit ac1f9aa
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("uk.gov.justice.hmpps.gradle-spring-boot") version "6.1.2"
kotlin("plugin.spring") version "2.0.21"
`jvm-test-suite`
}

configurations {
Expand All @@ -14,20 +15,47 @@ dependencies {
implementation("uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter:5.2.2")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0")

testImplementation("uk.gov.justice.service.hmpps:hmpps-kotlin-spring-boot-starter-test:1.1.1")
testImplementation("org.wiremock:wiremock-standalone:3.9.2")
testImplementation("io.swagger.parser.v3:swagger-parser:2.1.24") {
exclude(group = "io.swagger.core.v3")
}
}

kotlin {
jvmToolchain(21)
}

testing {
suites {
@Suppress("UnstableApiUsage")
val test by getting(JvmTestSuite::class) {
useJUnitJupiter()
}

@Suppress("UnstableApiUsage")
register<JvmTestSuite>("integrationTest") {
dependencies {
kotlin.target.compilations { named("integrationTest") { associateWith(getByName("main")) } }
implementation("uk.gov.justice.service.hmpps:hmpps-kotlin-spring-boot-starter-test:1.1.1")
implementation("org.wiremock:wiremock-standalone:3.9.2")
implementation("io.swagger.parser.v3:swagger-parser:2.1.24") {
exclude(group = "io.swagger.core.v3")
}
}

targets {
all {
testTask.configure {
shouldRunAfter(test)
}
}
}
}
}
}

tasks {
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21
}

check {
dependsOn(named("test"), named("integrationTest"))
}
}
File renamed without changes.

0 comments on commit ac1f9aa

Please sign in to comment.