Put the following code into the "Setup Script" of a Test Suite.
The following code takes #Project# level properties 'A' and 'B' and disables Test Cases where the Test Case number (in order of execution) is less than A or greater than B.
A and B are zero-indexed, that is a value of "0" (zero) means the first Test Case in the TestSuite.
If either A or B do not exist, or are empty properties, then all test cases will be enabled.
def (A,B) = ['','']; // Initially assign each an empty string.
A = context.expand( '${#Project#A}' ) //Run this test case (zero-indexed)
B = context.expand( '${#Project#B}' ) //Through this test case (zero-indexed)
// If A or B is empty then enable all test cases and return
if ( A == '' || B == '' ) {
log.warn 'One of A,B not set. All test cases will be enabled.'
testSuite.testCaseList.each { it.disabled = false }
return 0
}
A = A.toInteger(); B = B.toInteger() //convert to integer
log.info 'Total number of TestCases in TestSuite[' + testSuite.label + ']: ' + testSuite.testCaseCount
lastCase = testSuite.testCaseCount - 1 //get index of last test case (zero-indexed)
log.info 'A=='+A+' B=='+B+' Disabling test cases 0-' + (A-1) + ' and ' + (B+1) + '-' + lastCase
for ( i in ((0..lastCase)-(A..B)) ) { //disable all test cases before A and after B
def testCase = testSuite.getTestCaseAt(i)
testCase.disabled = true
if ( testCase.disabled == true ) log.info 'Disabled test cast ' + i + ' (' + testCase.label + ')'
}