gradle / gradle

Adaptable, fast automation for all
https://gradle.org
Apache License 2.0
16.65k stars 4.66k forks source link

Test Suite documentation lacks JUnit tag example #29900

Open jasonab opened 1 month ago

jasonab commented 1 month ago

Issue type

Wrong or misleading information

Problem description

In pre-test suite Gradle code, you could configure JUnit options in a closure under useJUnitPlatform, e.g.

   useJUnitPlatform {
        excludeTags("IntegrationTest", "BenchmarkTest")
    }

However, with test suites (and useJUnitJupiter()), there is no closure under the JUnit configuration call. Instead, you have to declare an options block inside of the testTask, cast the options variable to JUnitPlatformOptions manually, and call excludeTags on that object. Ignoring the lack of type-safe code here, this approach is not documented anywhere in the test suite documentation, leaving people to guess based on TestNGOptions and extrapolate from there. The documentation should clearly show how to do common JUnit tasks, like filtering on tags.

Context (optional)

No response

Page with the problem

https://docs.gradle.org/8.9/userguide/jvm_test_suite_plugin.html

ljacomet commented 1 month ago

This issue needs a decision from the team responsible for that area. They have been informed. Response time may vary.


This feels like it might be more than a documentation issue in case new APIs are required to support the use-case described here.

big-guy commented 1 month ago

We currently do not expose test framework options at the top level of a test suite, but this is something we intend to do somehow. Currently, the only way to achieve this is by configuring the task directly.

jasonab commented 1 month ago

My interpretation of test suite theory is that, instead of using tags, I should split my tests into different suites (based on how I used tags). This is fine, but I wish you guys would tell me that! All I really want is a straight answer for when I Google how to migrate my tagged tests, but that straight answer does not seem to exist in the Gradle documentation.