1

Please note there are several similar questions (like this and this and this and this) regarding how to set source-set for integration tests in Gradle but none of them is using JvmTestSuite.

I've got my build.gradle.kt configured as below (please let me know if full script is needed to answer my question):

testing {
    suites {
        val test by getting(JvmTestSuite::class) {
            useJUnitJupiter()
        }

        val integration by registering(JvmTestSuite::class) {
            testType.set(TestSuiteType.INTEGRATION_TEST)

            dependencies {
                implementation(project)
            }

            sources {
                java {
                    setSrcDirs(listOf("src/it/java"))
                }
                resources {
                    setSrcDirs(listOf("src/it/resources"))
                }
            }

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

Having that, Gradle finds my Java tests in java folder and runs them correctly. Now my question is how to set the source directory for kotlin folder. The same syntax doesn't seem to work. I also tried different solutions found on the web, but none works. Thanks.

Update
It seems to be as simple as:

java {
    setSrcDirs(listOf("src/it/kotlin"))
}

I'll wait if someone else has a better answer.

Rad
  • 4,292
  • 8
  • 33
  • 71

0 Answers0