This message was deleted.
# general
s
This message was deleted.
v
Make the integration test configurations extend the productive test configurations you want to have the dependencies from. This is not generally done by default as there might be test suites that do not need those dependencies so you are more flexible. The default
test
test suite for unit tests has
Copy code
testCompileClasspath.extendsFrom(implementation, compileOnlyApi)
testRuntimeClasspath.extendsFrom(implementation, runtimeOnly)
You probably want something similar.
d
How would I get a reference to those from within an
register("integrationTest", JvmTestSuite::class) { dependencies { ..  } }
block?
testCompileClasspath
for example.
v
Those are configurations, not dependencies. And don't try to configure the ones that are already configured, but the ones of your own test suite
Something like this probably:
Copy code
val integrationTestCompileClasspath by configurations.getting {
    extendsFrom(configurations.implementation.get())
    extendsFrom(configurations.compileOnlyApi.get())
}
val integrationTestRuntimeClasspath by configurations.getting {
    extendsFrom(configurations.implementation.get())
    extendsFrom(configurations.runtimeOnly.get())
}
d
I don't get why so many examples prefer declaring a variable for such things when it results in unused variable warnings. That does however seem to properly depend on the project. How would I go on to depend on whatever test configuration depends on?
Adding
extendsFrom(configurations.testImplementation.get())
did at least not help.
ah, had to add to runtimeclass path as well, still breaks, but progress.
Ah, I suspect some properties that i set via
withType(Test::class.java) { systemProperty("...", "...") }
aren't set when executing like this. That can probably be fixed. Thanks for the help.
v
I don't get why so many examples prefer declaring a variable for such things
Clearer to read, no "hard-coded string" but a variable name, can be used for other configurations, and usually they are not highlighted as unused, because they are used. Their name is used by the delegate mechanism. If it is shown as unused, that usually means there is a bug in the Kotlin IntelliJ plugin you should report. But in this case, the plugin got it correctly, no unused warning:
Ah, I suspect some properties that i set via 
withType(Test::class.java) { systemProperty("...", "...") }
 aren't set when executing like this. That can probably be fixed. Thanks for the help.
While I prefer
withType<Test> { ... }
for readability, both are equally fine and should configure all tasks of type
Test
, including the integration test ones.