Forum Discussion

AngieD18's avatar
AngieD18
Contributor
11 months ago

Script Assertion XPath: Is it possible to verify multiple tags and verify multiple fields

Hi soapUI Wizards,

I have two questions:

 

My response has an acceptedStatus object with two tags:

<acceptedStatus>

       <acceptedDate>07/25/2022</acceptedDate>

       <medicareUtilization>Full</medicareUtilization>

 </acceptedStatus>

 

  1.  Can I verify that the two tags are returned, spelled properly, and are in the right order.  Is this possible with a XPath Query Script Assertion, or should I use a Groovy Script?  I tried XPath Match, but that matches the entire response.  Can I use that to match just a section of the response?

 

  1. Can I also verify multiple contents in a single XPath Query Script?  In the same acceptedStatus object, now I want to verify the contents.  Right now, I can check one value.  Can I check two values in a single XPath Query Script Assertion?


This is my XQuery Path script assertion:

declare namespace wsse='http://docs.space.org/wss/2444/01/wss-wssecurity-secext.xsd';

declare namespace ec='http://www.w3.org/2001/10/xml-exc#';

declare namespace soap='http://www.w3.org/2003/05/soap-envelope';

declare namespace ns2='http://services.star/';

declare namespace ds='http://www.w3.org/xmldsig#';

declare namespace wsu='http://docs.space.org/wss/244/01/wss-wssecurity-utility.xsd';

//ns2:getAcceptRejectSubmissionsResponse/response[1]/listOfSubmissions[1]/submission[1]/acceptedStatus[1]/acceptedDate

 

This returns the value of the acceptedDate.  I've tried changing the namespace defintion, but without luck.

 

Thank you for your help.

Angie

No RepliesBe the first to reply