Is it possible in to only run tests in a certain _directory_ via command line (in Android Studio/Gradle)?

Viewed 80

I have a need to separate running "unit tests" from more specifically named unit tests called "requirements tests". Directory structure like:

src
 |__main\
 |__test\
 |__testRequirements\

I added a separate srcSet so I can run these all together no problem.

sourceSets {
  test {
    java.srcDirs = ['src/test/java', 'src/testRequirements/java']
  }
}

But, I need to be able to run ONLY the testRequirements by command so I can have ONLY them run in their own CI flow. I see that I can target them specifically by using the filtering by package/class/method a la:

./gradlew test --tests *RequirementsTest

But that relies on humans appending the same string to every class name.


I played around a little with creating a new flavor just for requirements so I could access with a command ./gradlew testRequirementsDebugUnitTest but that would run both the requirements AND all my other unit tests

0 Answers
Related