木吟

导航

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/

posted on 2016-09-05 11:17  木吟  阅读(259)  评论(0编辑  收藏  举报