How to exclude a single test *method*

(Korbinian Schmid) #1

I know you can exclude test classes like this

test {
  exclude "**/MyTest.class"

However, I want to exclude only a single method in that test class. Something like this:

test {
  exclude "**/MyTest.class#testMethod"

Any way to achieve this behavior?

(Mark Vieira) #2

Unfortunately, no. The includes/excludes here work on file patters so you can only match against an entire class.

(Korbinian Schmid) #3

Thanks, Mark. Is that kind of feature planned for the future? Looks like the TestFilter class can already do method-grained filtering. Maybe we can simply add exclude to that class?

(Oskar van Rest) #4

Hi, I wonder if any improvements have been made to support this case. We have a few large files with many tests and only want to exclude a few tests from each.