SoapUI Groovy:检查测试步骤是否为soap请求

时间:2016-08-19 05:20:44

标签: groovy soapui

有没有办法检查某个测试步骤是否是肥皂请求?

目前我在测试用例结束时有一个<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script>并循环遍历所有测试步骤以记录请求和响应。

我想忽略不是请求的步骤。如果这是相关信息,我将使用Groovy Script访问每个步骤。

1 个答案:

答案 0 :(得分:4)

是的,可以在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                
}