This message was deleted.
# general
s
This message was deleted.
m
For the test infrastructure, test-fixtures should work, unless I misunderstood your request. For the dependencies, we use something like this to avoid having to specify them twice:
Copy code
configurations.integrationTestImplementation.extendsFrom testImplementation
If you're using the analyzeDependencies plugin, this will have to be taken into account, else you can get a lot of UnusedDeclared violations there. EDIT: safer code that will fail if generated config name ever changes
s
Let me clarify my first question:- Basically we want to write some common test classes and some other codes that we then want to use in both the places: "test" as well as "smokeTest" test classes. How can we achieve it, without writing same classes in both locations ?
m
Check out the test-fixtures plugin, that should do exactly what you need. Tests don't work directly (and don't make much sense to duplicate), but you can place base classes for tests there and subclass them in your respective test source sets, to have them executed
🙌 1
s
Awesome thanks !! 😄
d
@Markus Maier Is there any way to just extend all the test* configurations? Similar to how the unbroken-dome testsets plugin works?
m
@Daniel Svensson You mean instead of test-fixtures, so the shared code would reside in
src/test
and still be usable from
src/integrationTest
? That would be possible, I suppose, but it requires more manual configuration and is not as cleanly separated. In our project, we were quite happy when we could ditch that approach for test-fixtures.
d
Just realized what I was missing, within the integrationTest JvmTestSuite scope:
Copy code
mapOf(
					"testCompileClasspath" to "integrationTestCompileClasspath",
					"testRuntimeClasspath" to "integrationTestRuntimeClasspath"
				).map { (src, dst) ->
					addExtendsFromRelation(dst, src)
				}
So it turns out I misread thread start. I actually asked a question first in the channel before removing it and asking here as I thought it was the same. Nevertheless, problem solved, unless there's some better way of dealing with it.
m
Just out of curiosity, what's the reason for not just plainly writing:
Copy code
configurations {
    integrationTestCompileClasspath.extendsFrom configurations.testCompileClasspath
    ...
}
d
I guess that's the groovy syntax version of:
Copy code
configurations {
		configurations["integrationTestCompileClasspath"].extendsFrom(configurations["testCompileClasspath"])
		configurations["integrationTestRuntimeClasspath"].extendsFrom(configurations["testRuntimeClasspath"])
	}
... and yep, works fine as well.
ehmm minus the configurations block there.
So:
Copy code
configurations {
		get("integrationTestCompileClasspath").extendsFrom(get("testCompileClasspath"))
		get("integrationTestRuntimeClasspath").extendsFrom(get("testRuntimeClasspath"))
	}
perhaps.