How to dynamically decide which test method to run in gradle

test-tag

(Frank Sha) #1

I want to run first 500 tests for a test suite. I found below code which can count/create index for each test. but how can I make sure that when numTests>500, it will skip the test.
In another word, how can I just run test as “AAATest” but not run test as “BBBTest”
any solutions?

def numTests = 0
test {
beforeTest { descriptor ->
System.out.println(“Running test " + numTests + " : " + descriptor)
numTests++
}
}
test << {
System.out.println(”\nnumTests executed: " + numTests);
}