我有一个soapUI测试步骤,可以在我的数据库中创建一个对象。我得到的XML响应包含一个我需要在下一步中引用的节点,即我需要键'guid'之后的值
<flex.messaging.io.amf.ASObject serialization="custom">
<unserializable-parents/>
<map>
<default>
<loadFactor>0.75</loadFactor>
<threshold>48</threshold>
</default>
<int>64</int>
<int>28</int>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<string>value</string>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<null/>
<string>key</string>
<null/>
<string>key</string>
<null/>
<string>key</string>
<null/>
<string>key</string>
<null/>
<string>key</string>
<null/>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<null/>
<string>key</string>
<string>value</string>
<string>key</string>
<string>value</string>
<string>key</string>
<object-array/>
<string>key</string>
<flex.messaging.io.amf.ASObject serialization="custom">
<unserializable-parents/>
<map>
<default>
<loadFactor>0.75</loadFactor>
<threshold>12</threshold>
</default>
<int>16</int>
<int>3</int>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
</map>
<flex.messaging.io.amf.ASObject>
<default>
<inHashCode>false</inHashCode>
<inToString>false</inToString>
<namedType>package/class</namedType>
</default>
</flex.messaging.io.amf.ASObject>
</flex.messaging.io.amf.ASObject>
<string>key</string>
<string>value</string>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<string>value</string>
<string>key</string>
<flex.messaging.io.amf.ASObject serialization="custom">
<unserializable-parents/>
<map>
<default>
<loadFactor>0.75</loadFactor>
<threshold>12</threshold>
</default>
<int>16</int>
<int>5</int>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
<string>key</string>
<boolean>value</boolean>
</map>
<flex.messaging.io.amf.ASObject>
<default>
<inHashCode>false</inHashCode>
<inToString>false</inToString>
<namedType>package/class</namedType>
</default>
</flex.messaging.io.amf.ASObject>
</flex.messaging.io.amf.ASObject>
<string>guid</string>
<string>818f40db-c217-46ed-a6a2-7c830d894a95</string>
<string>key</string>
<string>value</string>
<string>key</string>
<null/>
<string>key</string>
<string>value</string>
<string>key</string>
<string>value</string>
<string>key</string>
<null/>
<string>key</string>
<null/>
</map>
<flex.messaging.io.amf.ASObject>
<default>
<inHashCode>false</inHashCode>
<inToString>false</inToString>
<namedType>package/class</namedType>
</default>
</flex.messaging.io.amf.ASObject>
</flex.messaging.io.amf.ASObject>
我已经看到关于这个主题的各种问题,但似乎没有一个对我有用,我相信由于我错误地理解soapUI所期望的语法。
如果测试步骤1被称为'stepOne',我需要在'stepTwo'中引用XML响应, 为什么:
def temp = context.expand('$ {stepOne #Response // map [1] / string [27]}');
......不行。我假设我错误地引用了响应。我甚至会想办法在下一步中引用整个响应。然后我可以搜索它并使用groovy找到我需要的值。
我是否应该尝试转让房产?如果是这样,source将是stepOne,Response将是ResponseAsXml,target将是stepTwo,但我真的不想将整个xml分配给属性,我想分配JUST我需要的节点(map [1] /串[27])。
答案 0 :(得分:0)
是的,我们改为 Property Transfer TestStep !
但我真的不想将整个xml分配给一个属性,我想分配JUST我需要的节点
在源选择框下方有一个输入框。在那里,您可以编写要传输的节点的XPath表达式。
你可以在这里找到一个很好的教程: http://www.soapui.org/Functional-Testing/transfering-property-values.html