Skip to content

Commit

Permalink
refactor: Migrate to test suites
Browse files Browse the repository at this point in the history
Migrate to test suites to get rid of deprecation warnings and as
Gradle's way forward of testing.

Resolves #48
  • Loading branch information
stuebingerb committed Nov 5, 2024
1 parent 4b99397 commit 93bcd0f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
21 changes: 9 additions & 12 deletions buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
@file:Suppress("UnstableApiUsage")

import org.gradle.kotlin.dsl.kotlin
import org.gradle.kotlin.dsl.withType

plugins {
id("kgraphql-base")
kotlin("jvm")
`java-library`
`jvm-test-suite`
}

tasks
.withType<Test>()
.configureEach {
useJUnitPlatform()
testLogging {
showExceptions = true
showStandardStreams = true
events = setOf(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
exceptionFormat = TestExceptionFormat.FULL
testing {
suites {
withType<JvmTestSuite> {
useJUnitJupiter()
}
}
}
1 change: 0 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" }
kluent = { module = "org.amshove.kluent:kluent", version = "1.73" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
1 change: 0 additions & 1 deletion kgraphql-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ dependencies {
testImplementation(libs.kluent)
testImplementation(libs.ktor.server.test.host)
testImplementation(libs.ktor.server.auth)
testRuntimeOnly(libs.junit.jupiter.engine)
}
1 change: 0 additions & 1 deletion kgraphql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ dependencies {
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotlinx.coroutines.debug)
testImplementation(libs.kotlinx.coroutines.test)
testRuntimeOnly(libs.junit.jupiter.engine)
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import kotlin.reflect.typeOf
* Tests for SchemaBuilder behaviour, not request execution
*/
class SchemaBuilderTest {
@Suppress("UNCHECKED_CAST")
@Test
fun `DSL created UUID scalar support`() {

val testedSchema = defaultSchema {
stringScalar<UUID> {
description = "unique identifier of object"
Expand Down

0 comments on commit 93bcd0f

Please sign in to comment.