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/

上一篇:Java反射机制demo(三)—获取类中的构造函数


下一篇:在给mysql数据库备份时,报错: mysqldump: Got error: 145: Table '.\shengdaxcom\pre_forum_thread' is marked as c rashed and should be repaired when using LOCK TABLES