5

I am trying to use the gradle JVM test suite plugin to perform integration test for my Kotlin project. Some of the classes and apis are internal visibility.

I followed the sample code to create new test suite integrationTest:

testing {
    suites { 
        val integrationTest by registering(JvmTestSuite::class) { 
            dependencies {
                implementation(project) 
            }
            ...
        }
    }
}

But the source code under src/integrationTest/kotlin could not see internal classes in project main. I understand that the test suite of integrationTest is not in the same module with project main.

My questions are:

  1. why this behavior is not consistent with the default test suite test which can access internal classes in project main?
  2. If this is by design, how can I workaround this to make internal classes visible to test suite of integrationTest?
Race
  • 384
  • 1
  • 11
  • 27

1 Answers1

0

Had the same problem. Found an answer here: Adding an additional test suite to Gradle seems you need to add

compileClasspath += sourceSets["main"].runtimeClasspath

user994612
  • 35
  • 5