简体   繁体   中英

Exclude a single test file from Gradle

I have two test files in the same package. I would like gradle to run foo/ATest but not foo/BTest. Is there a way to set this up? At the moment I can't seem to exclude BTest when I include ATest. That is, this doesn't work:

test {
    java {
        srcDirs 'testSrc'
        include '**/foo/ATest.java'
        exclude '**/foo/BTest.java'
    }
}

Try to use a Test Filter TestFilter to do it:

test {
  java {
      srcDirs 'testSrc'
  }
  filter {
    includeTestsMatching "*.foo.ATest"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM