-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Unexpected default test task naming in JVM Test Suite plugin #25223
Comments
Thank you for your interest in Gradle! This issue needs a decision from the team responsible for that area. They have been informed. Response time may vary. The documentation demonstrate the creation of a test suite named If you register a test suite named |
Thank you for your feedback, unfortunately we have decided not to make this change. There are 2 main reasons why. First, we think it's important to be able to easily identify a source set containing test code vs. one containing production code, outside of the context of an IDE. The Second, and more importantly, we think of the name targets {
all {
testTask.configure {
shouldRunAfter(test)
}
}
} You can wire the test task to other tasks using: tasks.named("check") {
dependsOn(testing.suites.named("integrationTest"))
} In neither of those cases are you referencing the task by name, you're only working with the suite. It's true that when using the CLI you still must name the task to run it (unless it is run indirectly as a dependency of another lifecycle task, like |
Expected Behavior
The default test task name is
test<capitalized-test-suite-name>
(or<test-suite-name>Test
).Current Behavior
The default test task name equals the test suite name.
Context (optional)
JVM tasks in Gradle are usually named using
SourceSet.getTaskName()
. This approach provides consistent naming that is easily recognizable.Let's say we add a source set
integration
. In this case, we have these tasks:compileJava
,compileTestJava
,compileIntegrationJava
compileKotlin
,compileTestKotlin
,compileIntegrationKotlin
processResources
,processTestResources
,processIntegrationResources
checkstyleMain
,checkstyleTest
,checkstyleIntegration
pmdMain
,pmdTest
,pmdIntegration
I'd say we have a clear pattern here.
However,
jvm-test-suite
plugin uses another approach. When we createintegration
test suite (by callingtesting.suites.create('integration', JvmTestSuite)
), this happens:integration
source set is created - this is expectedintegration
Test
task is created - this is unexpected and not consistent with what we have for other JVM tasks (see earlier)Some usage examples of
jvm-test-suite
plugin suggest using test suite names likeintegrationTest
. The problem here is that there are a few articles on the Internet about creating source sets namedintegration
orit
. Also, there are plugins that useintegration
source set andintegrationTest
task approach (name.remal.integration-tests
(my plugin, yes),com.coditory.integration-test
, etc). On top of that, there are well-known Maven approaches of creatingit
/integration
folders (notintegrationTest
).So, I'd say it's more common in the Java world to have
src/integration/java
, thansrc/integrationTest/java
. This means that the source set created byjvm-test-suite
plugin should beintegration
. But havingintegration
take name is not what developers expect to see.Steps to Reproduce
Create a JVM test suite:
This code creates a task named
integration
(of typeTest
).Gradle version
8.1.1
Build scan URL (optional)
No response
Your Environment (optional)
No response
The text was updated successfully, but these errors were encountered: