Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java-test-fixtures should propagate testFixturesRuntimeOnly dependencies #11336

Open
tbroyer opened this issue Nov 12, 2019 · 2 comments
Open
Labels
a:feature A new functionality in:testing

Comments

@tbroyer
Copy link
Contributor

tbroyer commented Nov 12, 2019

Currently, dependencies declared in testFixturesRuntimeOnly configuration (with the java-test-fixtures plugin) aren't propagated to the testRuntimeClasspath (I haven't tested but I suppose that's also the case when importing the project's test fixtures in another project).

Expected Behavior

Dependencies declared as testFixturesRuntimeOnly are propagated to the runtime classpath of anything that uses the test fixtures library.

Current Behavior

Dependencies declared as testFixturesRuntimeOnly are only available in the project's testFixturesRuntimeClasspath (which almost nobody ever use I suppose).

Context

I have unit and functional tests (using separate source sets) and want to share a JUnit 5 ArgumentProvider between them, so I thought about using the java-test-fixtures. I'm declaring the junit-jupiter-api and junit-jupiter-params as testFixturesApi, and that works well. But declaring the junit-jupiter-engine as testFixturesRutimeOnly doesn't make it available at runtime to the test and functionalTest tasks (through in the testRuntimeClasspath and functionalTestRuntimeClasspath, respectively).

I'm writing a new plugin (to share dependency capabilities to detect conflicts in logging frameworks; see #11300) and started with the sample project from gradle init from Gradle 5.6.4, then I added the java-test-fixtures plugin.

As a workaround, because functionalTestRuntimeOnly extends testRuntimeOnly, I could declare junit-jupiter-engine as testRuntimeOnly; but I was actually thinking about removing that inheritance (extension) between the source sets / configurations, specifically because they ought to be inherited (as dependencies) through the test fixtures.
I could also declare it as testFixturesImplementation even though I won't actually use it from the test fixture's code.

There must be other use-cases where you'd want to add a runtime dependency to test fixtures. Also, the testFixturesRuntimeOnly and testFixturesRuntimeClasspath configurations currently exist and are properly provisioned (looking at gradle dependencies), but are never actually used. I also noticed that testFixturesApiElements and testFixturesRuntimeElements configurations exist, but they are empty.

@tbroyer tbroyer added a:feature A new functionality from:contributor labels Nov 12, 2019
@tbroyer
Copy link
Contributor Author

tbroyer commented Nov 12, 2019

(fwiw, I backed up due to #11094, and am now using nebula.integtest to wire up my functional tests' source set: the shared code is in the test source set, and available from the integTest source set; not ideal but it works)

@mcmah309
Copy link

Issue fixed by upgrading from Gradle 6.8 to Gradle 7.3.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:testing
Projects
None yet
Development

No branches or pull requests

4 participants