Comments (8)
Hi,
I've got your sample project to compile and run the test with two small modifications:
- make sure that the
groovy-all
dependency version matches the one used by Spock, i.e. either upgradegroovy-all
to 2.4.x or downgrade Spock to1.1-groovy-2.3
- remove the
idea
plugin (not sure why this fixes the problem, but I'll look into it). Theidea
plugin built into Gradle was used by early versions of the IDEA Gradle support, right now I think it's only used to generate IDEA project files initially, IDEA now seems to use a different mechanism under the hood (which is neither documented nor open-sourced). That's why unfortunately the possibilities for a plugin to influence IDEA's behavior are now very limited.
from gradle-testsets-plugin.
Agree, removing the idea plugin makes the project work. However, I think the idea plugin still has relevance. It allows to customise the workspace (e.g. by manipulating the XML based configuration of IDEA projects).
For example in my project where I originally hit the problem I'm also using the https://github.com/tbroyer/gradle-apt-plugin. See https://github.com/SoftwareCraftsmen/continuousdelivery/blob/master/build.gradle
It has a plugin for managing apt configuration in IDEA. As soon as I add the plugin (id "net.ltgt.apt-idea" version "0.19"
), the same symptom appears (as the apt plugin pulls in the idea plugin again).
from gradle-testsets-plugin.
Suggestion doesn't work, ignore.
Hi MartinAhrer tkrullmann
At a guess, could you use something similar to the below? (untested)
sourceSets {
integrationTest {
compileClasspath += sourceSets.sharedTest.runtimeClasspath
}
}
from gradle-testsets-plugin.
After investigating a bit further: Could it be that this is a bug in IDEA? IDEA is able to run the code referencing the shared test code from the integration test. But the editor is showing the referenced class from sharedTest as unavailable (red in my color-scheme).
I have also tried replacing my setup by your concept of TestLibrary.
testSets {
sharedTest(TestLibrary)
integrationTest { imports sharedTest }
}
The effect is the same!
from gradle-testsets-plugin.
Strange, I'm experiencing the same.
I also noticed that the problem goes away when I mark testCommon/java
as "sources root" instead of "test sources root".
So maybe the IDEA editor has a problem with one test source importing another (even though the runner seems to take it).
The only "fix" I can imagine is to exempt test libraries from being marked as "test sources" by the plugin.
from gradle-testsets-plugin.
I have upgraded to 2.1.1 (with Gradle 5.1.1) and added a test library and trying to use it with a out-of-the-box source set test
provided by the java/groovy plugin.
testSets {
createLibrary ('sharedTest')
unitTest { imports sharedTest }
integrationTest { imports sharedTest }
}
The IDE is showing the same symptom but also now the build fails the compileTestGroovy
task when running ./gradlew test
.
This is the commit showing the bug: MartinAhrer/gradle-testset-plugin-ideabug@cb5f1ad
from gradle-testsets-plugin.
Using 2.1.1 with Gradle 5.5.1
trying to add a dependency from a module to integration tests:
dependencies {
implementation project(":core")
implementation project(":xxx")
e2eTestImplementation project(":xx").sourceSets.test.output
}
testSets {
e2eTest
}
This also fails with
Could not find method e2eTestImplementation() for arguments [test classes] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Both IDEA & CLI compile fails with the same error
If I remove the testSet definition & try same with like below, it works:
testImplementation project(":xx").sourceSets.test.output
from gradle-testsets-plugin.
After upgrading to version 2.2.1 of the plugin and Gradle 6.0.1 this issues still exists (with current IDEA 2019.1.3).
But a workaround is to use the new testFixtures feature introduced with Gradle 5.6.x. The IDE will then properly recognise the classes from the fixture.
testSets {
integrationTest {
}
}
sourceSets {
testFixtures {
java {
srcDirs = ['src/sharedTest/java']
}
groovy {
srcDirs = ['src/sharedTest/groovy']
}
}
}
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.