2
votes

I have the following structure in response

response

I need an assertion that would check that for the given Role a given Action is present.

I know how to check for specific node with exists(...), but how do I check for an action for the role? fe. Assert that REVOKE_ROLE, UPDATE_ROLE exist for myRole.

I tried to put both expression in the same assertion, but it seems SoapUI allows only one expression per assertion. If I put them in separate assertions it will match all actions I look for regardless of the role. Is this kind of check possible using the XPath Match or am I doing it wrong and I should use some other assertion?

1
was it a json or xml? - Rao
Would you mind providing usable sample response instead above one? - Rao
stackoverflow.com/questions/46966274/… coudl help. you can use groovy script and a map to store [Role] and [Action] - Gaurav Khurana
Please add xml in text instead of image. - Rao

1 Answers

1
votes

I managed to solve this using XQuery Match

expression:

<Result>
{
for $x in //ns1:getUserA/RolePro/RoleProv/Role[ns4:Abbreviation="myRole"]
return data($x/../Prov/Provi/ns4:Abbreviation/text())
}
</Result>

expected result:

<Result>REVOKE_ROLE UPDATE_ROLE GRANT_ROLE</Result>