2016-08-19 71 views
1

是否有方法檢查某個測試步驟是否爲肥皂請求?SoapUI Groovy:檢查測試步驟是否是肥皂請求

目前我在測試用例的末尾有一個Groovy Script,並循環所有測試步驟來記錄請求和響應。

我想忽略不是請求的步驟。如果這是相關信息,我正在使用context.testCase.getTestStepAt(i)訪問每個步驟。

回答

3

是的,可以在Groovy Script步驟中找到步驟是否具有特定類型,例如Wsdl,REST,Jdbc,HTTP,Groovy等。

請同樣在下面的腳本。

import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep 
import com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep 
import com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep 
import com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep 

//....other stuff 
//Initialise variable step before using it. 
if (step instanceof WsdlTestRequestStep) { 
    log.info "Found a request step of Wsdl/Soap type" 
    //do the stuff you wanted 

} else if (step instanceof RestTestRequestStep) { 
    log.info "Found a request step of Rest type" 
    //do the stuff you wanted 
} else if (step instanceof JdbcRequestTestStep) { 
    log.info "Found a request step of jdbc type " 
    //Do the stuff you wanted 
} else if (step instanceof HttpTestRequestStep) { 
    log.info "Found a request step of http type " 
    //do the stuff for http     
} 
相關問題