You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
In standard JVM projects, additional source sets like testFixtures or someCustomTestSuite are all considered independent variants of a component (see #854). This means that they need to declare all their dependencies. And are not expected to "inherit" any dependencies from main.
The test source set behaves different though. Here the dependencies from main are inherited and if you redeclare a dependencies in test – e.g. implementation("commons-io:commons-io") and testImplementation("commons-io:commons-io") – the recommendation is to remove the testImplementation(...) dependency.
This corresponds to the traditional setup in Gradle, where the Configurations of the test source set inherit from the Configurations of the main source set. Which in turn is a behavior that more or less corresponds to the Scopes in Maven.
Conceptually, I think both perspective can makes sense:
If test contains unit tests that deeply reach into the production code (e.g. test protected methods), the tests can be seen as an extension of the main code rather than an independent variant of the component.
If test contains functional tests that test the complete component through public interfaces, the tests can be seen as an independent variant of the component.
Describe the solution you'd like
If we want support defining "non-unit" tests in test, it would be great to have a configuration option for this like:
This is a nice to have I think. You can still get the desired setup by putting non-unit tests into other source sets (e.g. functionalTest or integrationTest) for which you automatically get the "independent variant" (2) behavior.
Additional context
I filed this issue to document and explain this behavior. And to have something to link to in projects that have to make setup decisions because of this. This issue can be closed if the described alternative is considered to be sufficient.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
In standard JVM projects, additional source sets like
testFixtures
orsomeCustomTestSuite
are all considered independent variants of a component (see #854). This means that they need to declare all their dependencies. And are not expected to "inherit" any dependencies frommain
.The
test
source set behaves different though. Here the dependencies frommain
are inherited and if you redeclare a dependencies in test – e.g.implementation("commons-io:commons-io")
andtestImplementation("commons-io:commons-io")
– the recommendation is to remove thetestImplementation(...)
dependency.This corresponds to the traditional setup in Gradle, where the Configurations of the test source set inherit from the Configurations of the main source set. Which in turn is a behavior that more or less corresponds to the Scopes in Maven.
Conceptually, I think both perspective can makes sense:
test
contains unit tests that deeply reach into the production code (e.g. test protected methods), the tests can be seen as an extension of the main code rather than an independent variant of the component.test
contains functional tests that test the complete component through public interfaces, the tests can be seen as an independent variant of the component.Describe the solution you'd like
If we want support defining "non-unit" tests in
test
, it would be great to have a configuration option for this like:Describe alternatives you've considered
This is a nice to have I think. You can still get the desired setup by putting non-unit tests into other source sets (e.g.
functionalTest
orintegrationTest
) for which you automatically get the "independent variant" (2) behavior.Additional context
I filed this issue to document and explain this behavior. And to have something to link to in projects that have to make setup decisions because of this. This issue can be closed if the described alternative is considered to be sufficient.
The text was updated successfully, but these errors were encountered: