Comments (2)
Hi,
if I understand you correctly you have an integrationTest
testset in C which contains some tests in addition to shared test utils that you would like to reuse in other modules.
First, I would strongly suggest to move the shared code to a separate "test library" that contains no test but only utilities. Otherwise, with the default settings of JUnit or TestNG, you would run those tests in every project that imports the library.
This scenario isn't something that the plugin covers directly. In general (without the plugin) you would follow these steps:
- In project C:
a) Create a source set for the test library (e.g.testLib
)
b) Create a Jar task that packages the test library (e.g.testLibJar
)
c) Create a configuration under which you will publish it (e.g.testLib
)
d) Declare an artifact that connects the configuration with the JAR
e) optionally, if in project C you also have tests that depend on the testLib, use the testsets plugin and declare a dependency like this
integrationTestImplementation sourceSets.testLib.output
Now, I suppose you could probably use the test sets plugin to achieve part of this because it covers (a) and (b) and (d) for you, by making a testSet
that doesn't actually contain any tests. However you would still need to do (c) yourself.
- In projects A and B:
a) use the test sets plugin
b) Declare a dependency like
integrationTestImplementation project(path: ':C', configuration: 'testLib')
So something like this (just jotting down, not tested code ;-) )
In project C
// 1a
sourceSets { testLib }
// 1b
task testLibJar(type: Jar) {
from sourceSets.testLib.output
}
// 1c
configurations { testLib }
// 1d
artifacts {
testLib testLibJar
}
// 1e
dependencies {
integrationTestImplementation sourceSets.testLib.output
}
When "abusing" the plugin:
// 1c
configurations { testLib }
// 1a, 1b and 1d
testSets {
testLib {
publishArtifact = true
artifactConfigurationName = 'testLib'
}
}
It could definitely be easier, but this is not really the scenario the plugin tries to address. I've been thinking about how to allow something like test libraries in the plugin, but so far there is no direct support.
Hope that helps!
from gradle-testsets-plugin.
Hi thank you for your answer.
My project C contains only shared test utils, no tests.
from gradle-testsets-plugin.
Related Issues (20)
- Gradle 7 support HOT 1
- Testset specific JaCoCo exec files unused HOT 1
- How can I use 'integrationTestImplementation` when naming the source set 'integration-test' HOT 1
- TestSetBase uses deprecated API which gets removed in Gradle 7.0 HOT 2
- Jacoco integration test report xml not generating HOT 1
- Resources in the wrong priority HOT 1
- How to pass jvm arguments when running integrationTest
- Jacoco integration test report html not generating
- Gradle build succeeds despite broken test set
- Question: Can you have separate and merged jacoco reports HOT 1
- Gradle is not resolving DependencyHandler methods for test sets HOT 2
- Unable to run single integration test HOT 1
- compileIntegrationTestJava can not find class in src/test/java HOT 1
- Can it run tests in Kotlin?
- Plugin application fails on Gradle 8.0 HOT 10
- Lombok does not work in a non-standard test set
- is possible to have `test` run in parallel but `integrationTest` to be sync?`
- Broken in gradle 8.2.1 HOT 1
- 4.1.0 broke IntelliJ IDEA support HOT 3
- 4.1.0 released with Java11 byte code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gradle-testsets-plugin.