關於soapUI和groovy,我試圖將XML中的斷言(工作)和響應都變爲一個變量。我得到錯誤如何在groovyScript中獲得testStep responseAsXml
groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.getResponseAsXml() is applicable for argument types:() values: [] error at line: 6
我已經嘗試添加import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
,但仍然不能確定它。我做了消息交換另一種嘗試,也無濟於事 - 從我的理解,你不能如果你想從com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
響應在這種特定情況下
import com.eviware.soapui.model.testsuite.Assertable.AssertionStatus
def TestCase = testRunner.getTestCase()
def StepList = TestCase.getTestStepList()
StepList.each
{
if(it.metaClass.hasProperty(it,'assertionStatus'))
{
if(it.assertionStatus == AssertionStatus.FAILED)
{
def ass = it.getAssertableContentAsXml()
def res = it.getResponseContentAsXml()
log.error "${it.name} " + "${it.assertionStatus}"
log.info ass + res
}
}
}
作爲例外說得很清楚。類['WsdlTestRequestStep'](https://www.soapui.org/apidocs/com/eviware/soapui/impl/wsdl/teststeps/WsdlTestRequestStep.html)沒有「getResponseContentAsXml」方法 –