diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2023-08-30 15:58:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-30 15:58:46 +0200 |
commit | c63ea36637ce956029fb15b1482c0683ecb8a587 (patch) | |
tree | 2b75a8a976b43530820e73dc60cce4b10d9fc005 /integration-tests | |
parent | 0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff) | |
download | dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2 dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip |
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'integration-tests')
26 files changed, 291 insertions, 254 deletions
diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index a3173af0..eba1dd47 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -3,7 +3,11 @@ plugins { } dependencies { - implementation(kotlin("test-junit")) + // Classes from src rely on JUnit's @TempDir and Kotlin's @AfterTest, + // thus these dependencies are needed. Ideally, they should be removed. + implementation(kotlin("test-junit5")) + implementation(libs.junit.jupiterApi) + implementation(libs.kotlinx.coroutines.core) implementation(libs.jsoup) implementation(libs.eclipse.jgit) diff --git a/integration-tests/cli/build.gradle.kts b/integration-tests/cli/build.gradle.kts index e20529a4..d5e70548 100644 --- a/integration-tests/cli/build.gradle.kts +++ b/integration-tests/cli/build.gradle.kts @@ -10,7 +10,7 @@ evaluationDependsOn(":runners:cli") evaluationDependsOn(":plugins:base") dependencies { - implementation(kotlin("test-junit")) + implementation(kotlin("test-junit5")) implementation(projects.integrationTests) } diff --git a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt index 7f6f9433..881f1c28 100644 --- a/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt +++ b/integration-tests/cli/src/main/kotlin/org/jetbrains/dokka/it/cli/AbstractCliIntegrationTest.kt @@ -8,11 +8,11 @@ import kotlin.test.assertTrue abstract class AbstractCliIntegrationTest : AbstractIntegrationTest() { protected val cliJarFile: File by lazy { - File(temporaryTestFolder.root, "dokka.jar") + File(tempFolder, "dokka.jar") } protected val basePluginJarFile: File by lazy { - File(temporaryTestFolder.root, "base-plugin.jar") + File(tempFolder, "base-plugin.jar") } @BeforeTest diff --git a/integration-tests/gradle/build.gradle.kts b/integration-tests/gradle/build.gradle.kts index 4c7a0398..7f0cb8d1 100644 --- a/integration-tests/gradle/build.gradle.kts +++ b/integration-tests/gradle/build.gradle.kts @@ -7,7 +7,10 @@ plugins { dependencies { implementation(projects.integrationTests) - implementation(kotlin("test-junit")) + implementation(kotlin("test-junit5")) + implementation(libs.junit.jupiterApi) + implementation(libs.junit.jupiterParams) + implementation(gradleTestKit()) implementation(libs.jsoup) diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt index 539941e0..6fc4e691 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleCachingIntegrationTest.kt @@ -2,10 +2,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.util.GradleVersion import java.io.File -import kotlin.test.* +import kotlin.test.assertEquals +import kotlin.test.assertTrue -abstract class AbstractGradleCachingIntegrationTest(override val versions: BuildVersions): AbstractGradleIntegrationTest() { - fun setupProject(project: File) { +abstract class AbstractGradleCachingIntegrationTest : AbstractGradleIntegrationTest() { + + fun setupProject(buildVersions: BuildVersions, project: File) { val templateProjectDir = File("projects", "it-basic") project.mkdirs() templateProjectDir.listFiles().orEmpty() @@ -22,7 +24,7 @@ abstract class AbstractGradleCachingIntegrationTest(override val versions: Build } // clean local cache for each test - if (versions.gradleVersion >= GradleVersion.version("7.0")) { + if (buildVersions.gradleVersion >= GradleVersion.version("7.0")) { //Gradle 7.0 removed the old syntax project.toPath().resolve("settings.gradle.kts").toFile().appendText( """ @@ -133,4 +135,4 @@ abstract class AbstractGradleCachingIntegrationTest(override val versions: Build } assertTrue(imagesDir.resolve("custom-resource.svg").isFile) } -}
\ No newline at end of file +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt index 95eaf596..396183a8 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Android0GradleIntegrationTest.kt @@ -1,19 +1,19 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.* -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* -import kotlin.test.Test +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class Android0GradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { +internal class AndroidTestedVersionsArgumentsProvider : TestedVersionsArgumentsProvider(TestedVersions.ANDROID) - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ANDROID +class Android0GradleIntegrationTest : AbstractGradleIntegrationTest() { + companion object { /** * Indicating whether or not the current machine executing the test is a CI */ @@ -24,9 +24,10 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst fun assumeAndroidSdkInstalled() { if (isCI) return - Assume.assumeTrue(isAndroidSdkInstalled) + if (!isAndroidSdkInstalled) { + throw IllegalStateException("Expected Android SDK to be installed") + } } - } @BeforeTest @@ -43,9 +44,10 @@ class Android0GradleIntegrationTest(override val versions: BuildVersions) : Abst File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { - val result = createGradleRunner("dokkaHtml", "-i", "-s").buildRelaxed() + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AndroidTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + val result = createGradleRunner(buildVersions, "dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) val htmlOutputDir = File(projectDir, "build/dokka/html") diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt index 66a13f7e..4af7b82e 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicCachingIntegrationTest.kt @@ -1,31 +1,30 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class BasicCachingIntegrationTest(override val versions: BuildVersions) : AbstractGradleCachingIntegrationTest(versions) { +class BasicCachingIntegrationTest : AbstractGradleCachingIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } - @BeforeTest - fun setupProjectFiles(){ - setupProject(projectDir) - } + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + setupProject(buildVersions, projectDir) - @Test - fun execute() { - runAndAssertOutcomeAndContents(TaskOutcome.SUCCESS) - runAndAssertOutcomeAndContents(TaskOutcome.FROM_CACHE) + runAndAssertOutcomeAndContents(buildVersions, TaskOutcome.SUCCESS) + runAndAssertOutcomeAndContents(buildVersions, TaskOutcome.FROM_CACHE) } - @Test - fun localDirectoryPointingToRoot() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun localDirectoryPointingToRoot(buildVersions: BuildVersions) { + setupProject(buildVersions, projectDir) + fun String.findAndReplace(oldValue: String, newValue: String): String { assertTrue(oldValue in this, "Expected to replace '$oldValue'") return replace(oldValue, newValue) @@ -37,26 +36,27 @@ class BasicCachingIntegrationTest(override val versions: BuildVersions) : Abstra .findAndReplace("integration-tests/gradle/projects/it-basic/src/main", "integration-tests/gradle/projects/it-basic") .also { projectKts.writeText(it) } - runAndAssertOutcomeAndContents(TaskOutcome.SUCCESS) + runAndAssertOutcomeAndContents(buildVersions, TaskOutcome.SUCCESS) projectDir.resolve("unrelated.txt").writeText("modified") // despite projectDir is used as an input in localDirectory, changing its contents shouldn't invalidate the cache - runAndAssertOutcomeAndContents(TaskOutcome.FROM_CACHE) + runAndAssertOutcomeAndContents(buildVersions, TaskOutcome.FROM_CACHE) projectKts.readText() .findAndReplace("localDirectory.set(projectDir)", "localDirectory.set(file(\"src\"))") .also { projectKts.writeText(it) } // changing localDirectory path invalidates cached task results - runAndAssertOutcome(TaskOutcome.SUCCESS) + runAndAssertOutcome(buildVersions, TaskOutcome.SUCCESS) } - private fun runAndAssertOutcomeAndContents(expectedOutcome: TaskOutcome) { - runAndAssertOutcome(expectedOutcome) + private fun runAndAssertOutcomeAndContents(buildVersions: BuildVersions, expectedOutcome: TaskOutcome) { + runAndAssertOutcome(buildVersions, expectedOutcome) File(projectDir, "build/dokka/html").assertHtmlOutputDir() } - private fun runAndAssertOutcome(expectedOutcome: TaskOutcome) { + private fun runAndAssertOutcome(buildVersions: BuildVersions, expectedOutcome: TaskOutcome) { val result = createGradleRunner( + buildVersions, "clean", "dokkaHtml", "-i", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt index d3598591..212003a2 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGradleIntegrationTest.kt @@ -1,17 +1,15 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class BasicGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class BasicGradleIntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -32,14 +30,16 @@ class BasicGradleIntegrationTest(override val versions: BuildVersions) : Abstrac } } - @Test - fun execute() { - runAndAssertOutcome(TaskOutcome.SUCCESS) - runAndAssertOutcome(TaskOutcome.UP_TO_DATE) + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + runAndAssertOutcome(buildVersions, TaskOutcome.SUCCESS) + runAndAssertOutcome(buildVersions, TaskOutcome.UP_TO_DATE) } - private fun runAndAssertOutcome(expectedOutcome: TaskOutcome) { + private fun runAndAssertOutcome(buildVersions: BuildVersions, expectedOutcome: TaskOutcome) { val result = createGradleRunner( + buildVersions, "dokkaHtml", "dokkaJavadoc", "dokkaGfm", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt index e54a140c..f0d00ac3 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/BasicGroovyIntegrationTest.kt @@ -1,21 +1,15 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File +import kotlin.test.BeforeTest import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertTrue -import kotlin.test.BeforeTest -import kotlin.test.Test -class BasicGroovyIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class BasicGroovyIntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -28,9 +22,10 @@ class BasicGroovyIntegrationTest(override val versions: BuildVersions) : Abstrac File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { - val result = createGradleRunner("dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "-i", "-s") + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + val result = createGradleRunner(buildVersions, "dokkaHtml", "dokkaJavadoc", "dokkaGfm", "dokkaJekyll", "-i", "-s") .buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt index 0a0a48f7..637c16aa 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Collector0IntegrationTest.kt @@ -1,16 +1,15 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class Collector0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class Collector0IntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -21,9 +20,11 @@ class Collector0IntegrationTest(override val versions: BuildVersions) : Abstract File(templateProjectDir, "moduleA").copyRecursively(File(projectDir, "moduleA")) } - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, ":moduleA:dokkaHtmlCollector", ":moduleA:dokkaJavadocCollector", ":moduleA:dokkaGfmCollector", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/ConfigurationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/ConfigurationTest.kt index acb7c71e..735ea7aa 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/ConfigurationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/ConfigurationTest.kt @@ -1,9 +1,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull /** * Tests for Dokka's configuration options of the Gradle runner. @@ -17,13 +20,7 @@ import kotlin.test.* * key `name` and value `value`, which you can use to set the corresponding option's value * using Dokka's configuration DSL. */ -class ConfigurationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = listOf(TestedVersions.LATEST) - } +class ConfigurationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -40,10 +37,14 @@ class ConfigurationTest(override val versions: BuildVersions) : AbstractGradleIn * The test project contains some undocumented declarations, so if both `reportUndocumented` * and `failOnWarning` are enabled - it should fail */ - @Test + @ParameterizedTest(name = "{0}") + @ArgumentsSource(LatestTestedVersionsArgumentsProvider::class) @Suppress("FunctionName") - fun `should fail with DokkaException and readable message if failOnWarning is triggered`() { + fun `should fail with DokkaException and readable message if failOnWarning is triggered`( + buildVersions: BuildVersions + ) { val result = createGradleRunner( + buildVersions, "-info", "-stacktrace", "-Preport_undocumented=true", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt index b45caf77..05703a15 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/GradleRelocatedCachingIntegrationTest.kt @@ -1,34 +1,29 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.assertEquals +import kotlin.test.assertNotNull -class GradleRelocatedCachingIntegrationTest(override val versions: BuildVersions) : AbstractGradleCachingIntegrationTest(versions) { +class GradleRelocatedCachingIntegrationTest : AbstractGradleCachingIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } - - @BeforeTest - fun prepareProjectFiles() { - setupProject(projectFolder(1)) - setupProject(projectFolder(2)) - } + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + setupProject(buildVersions, projectFolder(1)) + setupProject(buildVersions, projectFolder(2)) - @Test - fun execute() { - runAndAssertOutcomeAndContents(projectFolder(1), TaskOutcome.SUCCESS) - runAndAssertOutcomeAndContents(projectFolder(2), TaskOutcome.FROM_CACHE) + runAndAssertOutcomeAndContents(buildVersions, projectFolder(1), TaskOutcome.SUCCESS) + runAndAssertOutcomeAndContents(buildVersions, projectFolder(2), TaskOutcome.FROM_CACHE) } - private fun runAndAssertOutcomeAndContents(project: File, expectedOutcome: TaskOutcome) { - val result = createGradleRunner("clean", "dokkaHtml", "-i", "-s", "-Dorg.gradle.caching.debug=true", "--build-cache") - .withProjectDir(project) - .buildRelaxed() + private fun runAndAssertOutcomeAndContents(buildVersions: BuildVersions, project: File, expectedOutcome: TaskOutcome) { + val result = createGradleRunner( + buildVersions, + "clean", "dokkaHtml", "-i", "-s", "-Dorg.gradle.caching.debug=true", "--build-cache" + ).withProjectDir(project).buildRelaxed() assertEquals(expectedOutcome, assertNotNull(result.task(":dokkaHtml")).outcome) diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt index 25986c88..8b10e1d2 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/JsIRGradleIntegrationTest.kt @@ -1,17 +1,15 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class JsIRGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class JsIRGradleIntegrationTest : AbstractGradleIntegrationTest() { private val ignoredKotlinVersions = setOf( // There were some breaking refactoring changes in kotlin react wrapper libs in 1.4.0 -> 1.5.0, @@ -34,15 +32,16 @@ class JsIRGradleIntegrationTest(override val versions: BuildVersions) : Abstract File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { - if (ignoredKotlinVersions.contains(versions.kotlinVersion)) { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + if (ignoredKotlinVersions.contains(buildVersions.kotlinVersion)) { return } - val reactVersion = TestedVersions.KT_REACT_WRAPPER_MAPPING[versions.kotlinVersion] - ?: throw IllegalStateException("Unspecified version of react for kotlin " + versions.kotlinVersion) - val result = createGradleRunner("-Preact_version=$reactVersion", "dokkaHtml", "-i", "-s").buildRelaxed() + val reactVersion = TestedVersions.KT_REACT_WRAPPER_MAPPING[buildVersions.kotlinVersion] + ?: throw IllegalStateException("Unspecified version of react for kotlin " + buildVersions.kotlinVersion) + val result = createGradleRunner(buildVersions, "-Preact_version=$reactVersion", "dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) val htmlOutputDir = File(projectDir, "build/dokka/html") diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt index 497dee0e..92cc33ee 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule0IntegrationTest.kt @@ -1,16 +1,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File import kotlin.test.* -class MultiModule0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class MultiModule0IntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -21,9 +17,11 @@ class MultiModule0IntegrationTest(override val versions: BuildVersions) : Abstra File(templateProjectDir, "moduleA").copyRecursively(File(projectDir, "moduleA")) } - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, ":moduleA:dokkaHtmlMultiModule", ":moduleA:dokkaGfmMultiModule", ":moduleA:dokkaJekyllMultiModule", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule1IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule1IntegrationTest.kt index 8786e0da..c01acab2 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule1IntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/MultiModule1IntegrationTest.kt @@ -1,19 +1,18 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue /** * This tests mainly checks if linking to relocated methods with no package works */ -class MultiModule1IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class MultiModule1IntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -25,9 +24,11 @@ class MultiModule1IntegrationTest(override val versions: BuildVersions) : Abstra File(templateProjectDir, "second").copyRecursively(File(projectDir, "second")) } - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, ":second:dokkaHtml", "-i", "-s" ).buildRelaxed() diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt index e73f6c82..8be1ba4e 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Multiplatform0GradleIntegrationTest.kt @@ -1,17 +1,15 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue -class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class Multiplatform0GradleIntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -22,9 +20,10 @@ class Multiplatform0GradleIntegrationTest(override val versions: BuildVersions) File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { - val result = createGradleRunner("dokkaHtml", "-i", "-s").buildRelaxed() + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + val result = createGradleRunner(buildVersions, "dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt index 62eea6bf..49ebcbcc 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt @@ -1,9 +1,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull /** * Creates 100 tasks for the test project and runs them sequentially under low memory settings. @@ -11,13 +14,7 @@ import kotlin.test.* * If the test passes, it's likely there are no noticeable memory leaks. * If it fails, it's likely that memory is leaking somewhere. */ -class SequentialTasksExecutionStressTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = listOf(TestedVersions.LATEST) - } +class SequentialTasksExecutionStressTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -30,9 +27,11 @@ class SequentialTasksExecutionStressTest(override val versions: BuildVersions) : File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(LatestTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, "runTasks", "--info", "--stacktrace", diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt index eb39ef4f..d0423e44 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt @@ -1,5 +1,13 @@ package org.jetbrains.dokka.it.gradle +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import java.util.stream.Stream + +internal class LatestTestedVersionsArgumentsProvider : TestedVersionsArgumentsProvider(listOf(TestedVersions.LATEST)) +internal open class AllSupportedTestedVersionsArgumentsProvider : TestedVersionsArgumentsProvider(TestedVersions.ALL_SUPPORTED) + internal object TestedVersions { val LATEST = BuildVersions("7.6.2", "1.9.0") @@ -50,3 +58,9 @@ internal object TestedVersions { "1.9.0" to "18.2.0-pre.597", ) } + +abstract class TestedVersionsArgumentsProvider(private val buildVersions: List<BuildVersions>) : ArgumentsProvider { + override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { + return buildVersions.stream().map { Arguments.of(it) } + } +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt index d6b23981..95119191 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/Versioning0IntegrationTest.kt @@ -2,16 +2,12 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome import org.jsoup.Jsoup -import org.junit.runners.Parameterized +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File import kotlin.test.* -class Versioning0IntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - } +class Versioning0IntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -30,9 +26,11 @@ class Versioning0IntegrationTest(override val versions: BuildVersions) : Abstrac * * Output is produced in a standard build directory under `build/dokka/htmlMultiModule` */ - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(AllSupportedTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, ":dokkaHtmlMultiModuleBaseVersion", "-i", "-s" ).buildRelaxed() @@ -42,6 +40,7 @@ class Versioning0IntegrationTest(override val versions: BuildVersions) : Abstrac assertTrue(outputDir.isDirectory, "Missing dokka output directory") val result2 = createGradleRunner( + buildVersions, "clean", ":dokkaHtmlMultiModuleNextVersion", "-i", "-s" @@ -52,6 +51,7 @@ class Versioning0IntegrationTest(override val versions: BuildVersions) : Abstrac assertTrue(outputDir2.isDirectory, "Missing dokka output directory") val result3 = createGradleRunner( + buildVersions, "clean", ":dokkaHtmlMultiModule", "-i", "-s" @@ -80,4 +80,4 @@ class Versioning0IntegrationTest(override val versions: BuildVersions) : Abstrac links.map { it.text() to it.attr("href") } ) } -}
\ No newline at end of file +} diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt index 00cc779a..443a136b 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/WasmGradleIntegrationTest.kt @@ -1,18 +1,27 @@ package org.jetbrains.dokka.it.gradle import org.gradle.testkit.runner.TaskOutcome -import org.junit.runners.Parameterized.Parameters +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* - -class WasmGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() { - - companion object { - @get:JvmStatic - @get:Parameters(name = "{0}") - val versions = TestedVersions.ALL_SUPPORTED - .filter { it.kotlinVersion >= "1.8.20" } // 1.8.20 is the first public version that can be tested with wasm +import java.util.stream.Stream +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +internal class WasmTestedVersionsArgumentsProvider : AllSupportedTestedVersionsArgumentsProvider() { + override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { + return super.provideArguments(context).filter { + val buildVersions = it.get().single() as BuildVersions + buildVersions.kotlinVersion >= "1.8.20" // 1.8.20 is the first public version that can be tested with wasm + } } +} + +class WasmGradleIntegrationTest : AbstractGradleIntegrationTest() { @BeforeTest fun prepareProjectFiles() { @@ -27,9 +36,10 @@ class WasmGradleIntegrationTest(override val versions: BuildVersions) : Abstract File(templateProjectDir, "src").copyRecursively(File(projectDir, "src")) } - @Test - fun execute() { - val result = createGradleRunner("dokkaHtml", "-i", "-s").buildRelaxed() + @ParameterizedTest(name = "{0}") + @ArgumentsSource(WasmTestedVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + val result = createGradleRunner(buildVersions, "dokkaHtml", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtml")).outcome) val htmlOutputDir = File(projectDir, "build/dokka/html") diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt index 24b2378d..1d0f5fee 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/CoroutinesGradleIntegrationTest.kt @@ -3,22 +3,32 @@ package org.jetbrains.dokka.it.gradle.kotlin import org.gradle.testkit.runner.TaskOutcome import org.jetbrains.dokka.it.TestOutputCopier import org.jetbrains.dokka.it.copyAndApplyGitDiff -import org.jetbrains.dokka.it.gradle.* -import org.junit.runners.Parameterized +import org.jetbrains.dokka.it.gradle.AbstractGradleIntegrationTest +import org.jetbrains.dokka.it.gradle.BuildVersions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* - -class CoroutinesGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), - TestOutputCopier { - - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = BuildVersions.permutations( - gradleVersions = listOf("7.4.2"), - kotlinVersions = listOf("1.8.10") - ) +import java.util.stream.Stream +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +class CoroutinesBuildVersionsArgumentsProvider : ArgumentsProvider { + private val buildVersions = BuildVersions.permutations( + gradleVersions = listOf("7.4.2"), + kotlinVersions = listOf("1.8.10") + ) + + override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { + return buildVersions.stream().map { Arguments.of(it) } } +} + +class CoroutinesGradleIntegrationTest : AbstractGradleIntegrationTest(), TestOutputCopier { override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } @@ -31,9 +41,11 @@ class CoroutinesGradleIntegrationTest(override val versions: BuildVersions) : Ab copyAndApplyGitDiff(File("projects", "coroutines/coroutines.diff")) } - @Test - fun execute() { + @ParameterizedTest(name = "{0}") + @ArgumentsSource(CoroutinesBuildVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { val result = createGradleRunner( + buildVersions, ":dokkaHtmlMultiModule", "-i", "-s", jvmArgs = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=500m") ).buildRelaxed() diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt index ff929391..e649cba9 100644 --- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/kotlin/SerializationGradleIntegrationTest.kt @@ -3,22 +3,32 @@ package org.jetbrains.dokka.it.gradle.kotlin import org.gradle.testkit.runner.TaskOutcome import org.jetbrains.dokka.it.TestOutputCopier import org.jetbrains.dokka.it.copyAndApplyGitDiff -import org.jetbrains.dokka.it.gradle.* -import org.junit.runners.Parameterized +import org.jetbrains.dokka.it.gradle.AbstractGradleIntegrationTest +import org.jetbrains.dokka.it.gradle.BuildVersions +import org.junit.jupiter.api.extension.ExtensionContext +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.Arguments +import org.junit.jupiter.params.provider.ArgumentsProvider +import org.junit.jupiter.params.provider.ArgumentsSource import java.io.File -import kotlin.test.* - -class SerializationGradleIntegrationTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest(), - TestOutputCopier { - - companion object { - @get:JvmStatic - @get:Parameterized.Parameters(name = "{0}") - val versions = BuildVersions.permutations( - gradleVersions = listOf("7.6.1"), - kotlinVersions = listOf("1.9.0") - ) +import java.util.stream.Stream +import kotlin.test.BeforeTest +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +class SerializationBuildVersionsArgumentsProvider : ArgumentsProvider { + private val buildVersions = BuildVersions.permutations( + gradleVersions = listOf("7.6.1"), + kotlinVersions = listOf("1.9.0") + ) + + override fun provideArguments(context: ExtensionContext?): Stream<out Arguments> { + return buildVersions.stream().map { Arguments.of(it) } } +} + +class SerializationGradleIntegrationTest : AbstractGradleIntegrationTest(), TestOutputCopier { override val projectOutputLocation: File by lazy { File(projectDir, "build/dokka/htmlMultiModule") } @@ -30,9 +40,10 @@ class SerializationGradleIntegrationTest(override val versions: BuildVersions) : copyAndApplyGitDiff(File("projects", "serialization/serialization.diff")) } - @Test - fun execute() { - val result = createGradleRunner(":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() + @ParameterizedTest(name = "{0}") + @ArgumentsSource(SerializationBuildVersionsArgumentsProvider::class) + fun execute(buildVersions: BuildVersions) { + val result = createGradleRunner(buildVersions, ":dokkaHtmlMultiModule", "-i", "-s").buildRelaxed() assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":dokkaHtmlMultiModule")).outcome) diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index 43cc575b..5caecafd 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -6,40 +6,35 @@ import org.gradle.testkit.runner.internal.DefaultGradleRunner import org.gradle.tooling.GradleConnectionException import org.gradle.util.GradleVersion import org.jetbrains.dokka.it.AbstractIntegrationTest -import org.junit.AssumptionViolatedException -import org.junit.runner.RunWith -import org.junit.runners.Parameterized import java.io.File import java.net.URI import kotlin.test.BeforeTest -@RunWith(Parameterized::class) abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { - abstract val versions: BuildVersions - @BeforeTest fun copyTemplates() { File("projects").listFiles().orEmpty() .filter { it.isFile } .filter { it.name.startsWith("template.") } - .forEach { file -> file.copyTo(File(temporaryTestFolder.root, file.name)) } + .forEach { file -> file.copyTo(File(tempFolder, file.name)) } } fun createGradleRunner( + buildVersions: BuildVersions, vararg arguments: String, jvmArgs: List<String> = listOf("-Xmx2G", "-XX:MaxMetaspaceSize=1G") ): GradleRunner { return GradleRunner.create() .withProjectDir(projectDir) .forwardOutput() - .withJetBrainsCachedGradleVersion(versions.gradleVersion) + .withJetBrainsCachedGradleVersion(buildVersions.gradleVersion) .withTestKitDir(File("build", "gradle-test-kit").absoluteFile) .withArguments( listOfNotNull( - "-Pkotlin_version=${versions.kotlinVersion}", - "-Pdokka_it_kotlin_version=${versions.kotlinVersion}", - versions.androidGradlePluginVersion?.let { androidVersion -> + "-Pkotlin_version=${buildVersions.kotlinVersion}", + "-Pdokka_it_kotlin_version=${buildVersions.kotlinVersion}", + buildVersions.androidGradlePluginVersion?.let { androidVersion -> "-Pdokka_it_android_gradle_plugin_version=$androidVersion" }, * arguments @@ -55,7 +50,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { val gradleConnectionException = e.withAllCauses().find { it is GradleConnectionException } if (gradleConnectionException != null) { gradleConnectionException.printStackTrace() - throw AssumptionViolatedException("Assumed Gradle connection", gradleConnectionException) + throw IllegalStateException("Assumed Gradle connection", gradleConnectionException) } throw e diff --git a/integration-tests/maven/build.gradle.kts b/integration-tests/maven/build.gradle.kts index 99a98649..7fbc4bff 100644 --- a/integration-tests/maven/build.gradle.kts +++ b/integration-tests/maven/build.gradle.kts @@ -8,7 +8,7 @@ plugins { dependencies { implementation(projects.integrationTests) - implementation(kotlin("test-junit")) + implementation(kotlin("test-junit5")) } tasks.integrationTest { diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt index adc75f43..1eb11cfe 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/AbstractIntegrationTest.kt @@ -1,10 +1,7 @@ package org.jetbrains.dokka.it import org.jsoup.Jsoup -import org.junit.Rule -import org.junit.rules.TemporaryFolder -import org.junit.runner.RunWith -import org.junit.runners.JUnit4 +import org.junit.jupiter.api.io.TempDir import java.io.File import java.net.URL import kotlin.test.assertEquals @@ -12,13 +9,12 @@ import kotlin.test.assertFalse import kotlin.test.assertNotNull import kotlin.test.assertTrue -@RunWith(JUnit4::class) abstract class AbstractIntegrationTest { - @get:Rule - val temporaryTestFolder = TemporaryFolder() + @field:TempDir + lateinit var tempFolder: File - val projectDir get() = File(temporaryTestFolder.root, "project") + val projectDir get() = File(tempFolder, "project") fun File.allDescendentsWithExtension(extension: String): Sequence<File> = this.walkTopDown().filter { it.isFile && it.extension == extension } diff --git a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt index 30770838..54712851 100644 --- a/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt +++ b/integration-tests/src/main/kotlin/org/jetbrains/dokka/it/TestOutputCopier.kt @@ -1,12 +1,12 @@ package org.jetbrains.dokka.it -import org.junit.After import java.io.File +import kotlin.test.AfterTest interface TestOutputCopier { val projectOutputLocation: File - @After + @AfterTest fun copyToLocation() { System.getenv("DOKKA_TEST_OUTPUT_PATH")?.also { location -> println("Copying to ${File(location).absolutePath}") |