debanjan
8 years agoOccasional Contributor
How can I assert a json parameter in Request with a XML response through Script Assertion in Soap UI
I am using SoapUI version 5.3.0 My Application have a couple of RESTful APIs. I am sending multiple request to a WebService in the form of a json request as below: { "app_key":"i8gAVDwcAq40n2kAv...
- 8 years agoLooks like you need to get property before use it in the assertion.
https://www.soapui.org/functional-testing/properties/working-with-properties.html - 8 years ago
You need to use context.expand to do property expansions in scripts:
context.expand('${#TestCase#TARGET_DB}'))
or you can access test case properties as follows:
context.testCase.getPropertyValue("TARGET_DB")
context.testCase.properties["TARGET_DB"].valueAlternatively it might be easier to use the XPath Match assertion instead of the Script assertion:
XPath expression: //*:RequestNumber
Expected result: ${#TestCase#TARGET_DB}
- 8 years ago
@debanjan, these expressions should be used in place of "${TARGET_DB}", that is:
if (nodeRequestNumber == context.expand('${#TestCase#TARGET_DB}'))
or
if (nodeRequestNumber == context.testCase.getPropertyValue("TARGET_DB"))
or
if (nodeRequestNumber == context.testCase.properties["TARGET_DB"].value)