SoapUI:在测试用例的中间设置MockService测试属性

时间:2013-06-10 17:04:02

标签: groovy soapui

美好的一天,

简要说明我计划实现的目标:

image of the problem and theory for solution

在测试用例中,我有一个groovy脚本来为当前的测试用例设置一个属性:

image of a script with unfinished solution

问题是:如何从Mock服务本身外部修改(设置)MockService属性值。我知道解决方案只是在上面的示例中添加正确的语法

一切顺利

2 个答案:

答案 0 :(得分:1)

您可以在模拟服务上下文中设置属性:

testRunner.testCase.testSuite.project.mockServices["yourMockService"].getMockRunner().getMockContext().setProperty("yourProperty","yourPropertyValue")

答案 1 :(得分:1)

我不需要getMockRunner()或getMockService()来为我的模拟设置属性。

这对我有用:

  

testRunner.testCase.testSuite.project.mockServices [“your_mock”]。setPropertyValue(“your_property_name”,“your_property_value”)

相关问题