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
I would like to be able to report test results directly to Gradle from within a custom Gradle task.
I want the reported tests to be visible in the Gradle test report, correctly reported when the tests are launched in IntelliJ, and visible in CI tools (like GitHub actions).
Current Behavior (optional)
There is no official way to report test results directly to Gradle. There is no workaround.
Because tests can't be reported to Gradle, this means that other tools that rely on Gradle's reporting can't pick up the custom tests.
IntelliJ can't display the test results, which is normally very useful and allows for utils like 'click to show difference'.
Custom tests can't be reported in CI tools, like GitHub.
Custom tests are missing from reports, metrics, stats.
Context
Here are some examples of when I want to report tests to Gradle:
I want to Kotest to support nested JavaScript tests. Currently this is not possible, because of limitations in the JavaScript testing frameworks (they do not support dynamically created nested tests). Because Kotest cannot directly report test results to Gradle, it looks like support might not even be possible.
I want to write a quick verification task. I want this to be reported to Gradle as a test.
val checkReadme by tasks.registering {
group ="verification"val readme = file("readme.md")
val projectVersion = project.version.toString()
doLast {
require("Current project version is $projectVersion"in readme.readText()) {
"Incorrect project version in readme"
}
}
}
I want BCV validation results to be reported as tests.
Because Gradle doesn't fully support JUnit features (see footnote 1), I want to run the tests manually using the JUnit console launcher, and report the results to Gradle. Example.
In theory, one could write a custom JUnit TestEngine to launch custom tests, but this is a prohibitive amount of work, especially for the simpler cases where I just want to report a single test case.
A custom TestEngine would also introduce a lot of extra complexity and layers, and potentially a new language for the non-JVM based tests. Even if using a custom TestEngine, Gradle doesn't fully support JUnit Platform (footnote 1), so this would be a non-starter.
Even if using a custom JUnit TestEngine, Gradle unnecessarily requires that the input property testClassesDirs of a Test task has .class files, even if not testing JVM tests!
Expected Behavior
I would like to be able to report test results directly to Gradle from within a custom Gradle task.
I want the reported tests to be visible in the Gradle test report, correctly reported when the tests are launched in IntelliJ, and visible in CI tools (like GitHub actions).
Current Behavior (optional)
There is no official way to report test results directly to Gradle. There is no workaround.
TestResultProcessor is internal.
Because tests can't be reported to Gradle, this means that other tools that rely on Gradle's reporting can't pick up the custom tests.
Context
Here are some examples of when I want to report tests to Gradle:
I want to Kotest to support nested JavaScript tests. Currently this is not possible, because of limitations in the JavaScript testing frameworks (they do not support dynamically created nested tests). Because Kotest cannot directly report test results to Gradle, it looks like support might not even be possible.
I want to write a quick verification task. I want this to be reported to Gradle as a test.
I want BCV validation results to be reported as tests.
Because Gradle doesn't fully support JUnit features (see footnote 1), I want to run the tests manually using the JUnit console launcher, and report the results to Gradle. Example.
I want to use a non-JVM testing framework, like Jasmine, Web Test Runner, Cucumber.
Custom JUnit TestEngine
In theory, one could write a custom JUnit TestEngine to launch custom tests, but this is a prohibitive amount of work, especially for the simpler cases where I just want to report a single test case.
A custom TestEngine would also introduce a lot of extra complexity and layers, and potentially a new language for the non-JVM based tests. Even if using a custom TestEngine, Gradle doesn't fully support JUnit Platform (footnote 1), so this would be a non-starter.
Even if using a custom JUnit TestEngine, Gradle unnecessarily requires that the input property
testClassesDirs
of a Test task has.class
files, even if not testing JVM tests!Related
Footnote 1: Here are the issues related to Gradle not fully supporting JUnit
The text was updated successfully, but these errors were encountered: