Skip to content

Instantly share code, notes, and snippets.

@alexbridge
Created August 12, 2024 11:53
Show Gist options
  • Save alexbridge/494198caa434cb1c16a1e250fb3c8d64 to your computer and use it in GitHub Desktop.
Save alexbridge/494198caa434cb1c16a1e250fb3c8d64 to your computer and use it in GitHub Desktop.
Gradle include Test Files or Test methods
useJUnitPlatform {
// Include Test Files
if (project.hasProperty('includeTestFiles')) {
((project.property('includeTestFiles') as String).tokenize(',')).each {
include "${it}"
}
}
filter {
// Include Test Methods
if (project.hasProperty('includeTests')) {
((project.property('includeTests') as String).tokenize(',')).each {
includeTestsMatching "${it}"
}
}
}
}
// Usage:
// Files: -PincludeTestFiles=**/*Test*
// Methods: -PincludeTests=*Test*,*method*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment