This is easy to do in the build script:
test { filter { filterTestsMatching "com.baz.bar.Foo", "com.bar.foo.Baz", ... } }
command line equivalent is gradle test --tests com.baz.bar.Foo (or just --tests Foo ), but from what I can say, only one class is supported here (more precisely, one template).
If you need the ability to pass multiple templates, you can script it yourself. For example, you can read the system property passed from the command line via -Dtest.filter=Foo,Bar,Baz , split the value into separate parts and pass them to filterTestsMatching .
Reinforcing --tests to support comma-separated values ββcan make a good pull request for a Gradle project.
source share