From c63ea36637ce956029fb15b1482c0683ecb8a587 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Wed, 30 Aug 2023 15:58:46 +0200 Subject: Migrate to JUnit 5 and unify used test API (#3138) --- .../org/jetbrains/conventions/base-java.gradle.kts | 16 ++-------------- .../conventions/dokka-integration-test.gradle.kts | 6 ++++-- 2 files changed, 6 insertions(+), 16 deletions(-) (limited to 'build-logic/src/main/kotlin') diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts index a4ed0ede..efeb8b17 100644 --- a/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts +++ b/build-logic/src/main/kotlin/org/jetbrains/conventions/base-java.gradle.kts @@ -27,24 +27,12 @@ tasks.withType().configureEach { } else { (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1 } + javaLauncher.set(javaToolchains.launcherFor { languageVersion.set(dokkaBuild.testJavaLauncherVersion) }) } dependencies { - testImplementation(platform("org.junit:junit-bom:5.9.2")) - // TODO Upgrade all subprojects to use JUnit Jupiter https://github.com/Kotlin/dokka/issues/2924 - // Replace these dependencies with `testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")` - // See https://junit.org/junit5/docs/current/user-guide/#running-tests-build-gradle-engines-configure - // Ideally convention plugins should only provide sensible defaults that can be overridden by subprojects. - // If a convention plugin defines dependencies, these cannot be easily overridden by subprojects, and so - // this should be avoided. However, for now , both JUnit 4 and 5 must be supported, and since these are test - // runtime-only dependencies they are not going to have a significant impact subprojects. - // These dependencies should be revisited in #2924, and (for example) moved to each subproject (which is more - // repetitive, but more declarative and clear), or some other solution. - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - testRuntimeOnly("org.junit.vintage:junit-vintage-engine") - // kotlin-test asserts for all projects - testImplementation(kotlin("test-junit")) + testImplementation(platform(libs.junit.bom)) } diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts index f9edb68e..cebdb541 100644 --- a/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts +++ b/build-logic/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts @@ -45,15 +45,17 @@ val integrationTest by tasks.registering(NonCacheableIntegrationTest::class) { maxHeapSize = "2G" description = "Runs integration tests." group = "verification" - useJUnit() - testClassesDirs = integrationTestSourceSet.output.classesDirs classpath = integrationTestSourceSet.runtimeClasspath + useJUnitPlatform() + setForkEvery(1) project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism -> maxParallelForks = parallelism } + + environment( "isExhaustive", project.properties["dokka_integration_test_is_exhaustive"]?.toString()?.toBoolean() -- cgit