Reputation: 335
So I am firm in java but I just started learning about groovy and testing SOAP requests using SOAPUI and groovy. I am trying to test a SOAP request using the groovy script and set the property value that the request then uses as parameters to test the xml. Now, I keep getting this error in the SOAP XML:
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Sender</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text xml:lang="en">Could not parse the XML stream.</soap:Text>
</soap:Reason>
<soap:Detail>
<cause>javax.xml.stream.XMLStreamException: cvc-datatype-valid.1.2.1: '' is not a valid value for 'integer'.</cause>
</soap:Detail>
</soap:Fault>
but I can see when the property value is being updated! I see it under the custom properties of my test case. The value being passed should be an integer, but setting property values can only be string. Could that be the problem? The annoying part of all this is that when I copy the value from the property value tab and paste directly into the XML, it works. So that kind of tells me my value is not being passed correctly. If I can see the value in the custom properties tab and the XML is not seeing it, it should mean it is not being passed correctly. In the XML, I tried calling the property value like this:
${#RequestID}
and tried this too:
${#TestCaseName#RequestID}
But none of them worked. I also set the property values like this:
testRunner.testCase.setPropertyValue(propertyValues[i],values[i])
and run the tests like this:
def testStep = testRunner.testCase.getTestStepByName(testStepName)
def result = testStep.run(testRunner,context)
What am I doing wrong? Please any help is appreciated.
Upvotes: 3
Views: 3301
Reputation: 335
The fault was mine. While reading through articles, they said this:
${#TestCase#ResquestID}
so I assumed I replace 'TestCase' with the name of my testcase which was wrong. I just passed it as is and it works fine.
Upvotes: 3