0
我想在參數的總和爲正創建一個常規的豆這需要一個請求的參數和返回適當的響應。我想知道我可以在Groovy bean的方法裝載了我的請求如何在groovy bean的方法中加載請求?
import com.eviware.soapui.support.XmlHolder
import com.eviware.soapui.support.GroovyUtils
import com.eviware.soapui.model.mock.*
import org.apache.commons.lang.StringUtils
import groovy.util.*
import groovy.lang.*
public class Test
{
public int somme()
{
def holder = new XmlHolder(mockRequest.getRequestContent())
def a = holder["//firstInt:a"]
def b = holder["//secondInt:b"]
return(a + b)
}
public String getResponse()
{
Test t = new Test()
if (t.somme() > 0)
{
return "response1"
}
else
{
return "response2"
}
}
}
當我運行此代碼,我有以下錯誤:
com.eviware.soapui.impl.wsdl.mock .DispatchException:無法使用腳本 調度; groovy.lang.MissingPropertyException:沒有這樣的 屬性:類的模擬請求:測試
那麼,什麼是'mockRequest'?它應該從哪裏來? –
它應該來自Mockservice用了SoapUI產生 – Raspoutine
我的目標是在實例化另一個腳本測試的類。 – Raspoutine