unbroken-dome / gradle-testsets-plugin

A plugin for the Gradle build system that allows specifying test sets (like integration or acceptance tests).
MIT License
230 stars 50 forks source link

in our integration testSet we'd like to use a unit test's class #107

Closed lfarkas closed 4 years ago

lfarkas commented 4 years ago

there is a common a test class which we'd like to use in both normal unit test and integration test. the strange thing is that the generated eclipse classpath contains it since it build and do not gives error. but in our integration testSet we can't use it from command line ./gradlew integration because of the missing class from the unit test. unfortunately i can't add

testSets {
     integration { extendsFrom test }
}

since it gives error. of course we can put the class into the main sourceSet but we wouldn't like to do so. is there any solution to this?

tkrullmann commented 4 years ago

Hi, this is pretty much what the "test libraries" were introduced for. They're intended for supporting code shared between multiple test sets. Please check the readme for a description and usage.

Of course, you could try the "quick and dirty" way and just add a dependency on the test source set's output:

dependencies {
    integrationTestImplementation sourceSets.test.output
}
lfarkas commented 4 years ago

ok but AFAIS the "normal" java built in test configuration is the unitTest testSet so i can write:

testSets {
    integration {
        imports unitTest
    }
}

but it's not working.