Disable testSuite and testCase on some environment
def testEnv = context.expand('${#Project#testEnv}') String[] testCases = ["CheckEARouting(ADS)AndNotDisplayHolding","CheckEARouting(ADS)AndDisplayHolding","CheckEquityAttributionDataAccuracy"] if(testEnv=="DEV"){ disableTestSuiteAndTestCases("AAA",null,true) disableTestSuiteAndTestCases("BBB",testCases,true) }else{ disableTestSuiteAndTestCases("AAA",null,false) disableTestSuiteAndTestCases("BBB",testCases,false) } // disable some testSuite or some testCases below the testSuite def disableTestSuiteAndTestCases(String testSuiteName, String[] testCaseNames, boolean flag){ if(testSuiteName==null){ assert false, "Test suite name can't be null." }else if(testCaseNames==null){ testRunner.testCase.testSuite.project.getTestSuiteByName(testSuiteName).setDisabled(flag) }else{ for (String testCaseName in testCaseNames){ testRunner.testCase.testSuite.project.getTestSuiteByName(testSuiteName).getTestCaseByName(testCaseName).setDisabled(flag) } } }
Reference DOC: http://sothatsit.com/computers-software/soapui/groovy-scripting-soapui/disable-setdisabled/