Skip to content
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

Programmatic naming for test suites #28938

Open
tcfurrer opened this issue Apr 23, 2024 · 1 comment
Open

Programmatic naming for test suites #28938

tcfurrer opened this issue Apr 23, 2024 · 1 comment
Labels
a:feature A new functionality in:test-suites Work related to the JvmTestSuite Plugin 👋 team-triage Issues that need to be triaged by a specific team

Comments

@tcfurrer
Copy link

Expected Behavior

Some way to create a set of test suites whose names are given from a programmatically-generated list, instead of being directly coded into the gradle script.

Something like: (notice the [broken] use of "${suiteName}" and iteration over myListOfSuites [created earlier])

// See: https://docs.gradle.org/current/userguide/jvm_test_suite_plugin.html
def myListOfSuites = ['generated','by','earlier','code']
testing {
    suites {
        test {
            useJUnitJupiter()
        }

        myListOfSuites.each { suiteName ->
            "${suiteName}"Test(JvmTestSuite) {
                targets {
                    all {
                        testTask.configure {
                            description = "Runs all tests tagged with '${suiteName}'"
                            options.includeTags suiteName
                        }
                    }
                }
            }
        }
    }
}

Current Behavior (optional)

Gradle fails with:

   > Could not create an instance of type org.gradle.api.plugins.jvm.internal.DefaultJvmTestSuite.
      > Cannot add task 'processTestResources' as a task with that name already exists.

Context

I want to define a set of test suites without hardcoding their names into the groovy code (for example, they might come from parsing an external file). I have not yet found a way to accomplish this.

@tcfurrer tcfurrer added a:feature A new functionality to-triage labels Apr 23, 2024
@ov7a ov7a added in:test-suites Work related to the JvmTestSuite Plugin 👋 team-triage Issues that need to be triaged by a specific team and removed to-triage labels Apr 25, 2024
@ov7a
Copy link
Member

ov7a commented Apr 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:test-suites Work related to the JvmTestSuite Plugin 👋 team-triage Issues that need to be triaged by a specific team
Projects
None yet
Development

No branches or pull requests

2 participants