0

I'd like to exclude some tests from a srcSet in Gradle. Basically integration tests and unit tests have been mixed up (there are thousands).

I can tell which is which by looking at the content.

If the content contains some specific code I know it's an integration test.

How can I modify a srcSet like this:

sourceSets {
    val test by getting
    test.java.srcDirs("src")
}

to exclude certain files by content ?

PaulNUK
  • 4,774
  • 2
  • 30
  • 58
  • 1
    I wouldn't use a SourceSet. Instead, I would use an exclude on the test task: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:exclude(org.gradle.api.specs.Spec) – JB Nizet Jan 17 '20 at 11:28
  • 2
    But if it's a mess, and if you write code to distinguish integration tests from unit tests anyway, why not use that code to move them to a separate directory, and clean the mess? – JB Nizet Jan 17 '20 at 11:29

0 Answers0