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/gradle/src/integrationTest/kotlin/org/jetbrains/dokka | |
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/gradle/src/integrationTest/kotlin/org/jetbrains/dokka')
18 files changed, 265 insertions, 226 deletions
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) |