cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath assertion that contain more than 1 match

Highlighted
Frequent Contributor

Xpath assertion that contain more than 1 match

It would be good to have the ability to be able to create an XPath Assertion that has more than one match.  For example:

Say I have a response that contains about 15 Field element.  4 of the Field elements have a Label attribute value that contain the common string "label" (label1, label2, label3, label4)

The following would return all 4 elements:

declare namespace ns2='http://skillsoft.com/Hapi/WebService';
//ns2:getUserStatInfoResponse[1]/return[1]/SkillPort[1]/BaseSite[1]/UserStatFields[1]/Field[contains(@Label,"label")]

I'll just create seperate assertions for this, so I can work around it. Currently you can only have one match for an xpath assertion. 

Thanks,

Mary
4 REPLIES 4
Highlighted

Re: Xpath assertion that contain more than 1 match

Hi Mary,

you're right.. currently you can use the XQuery assertion instead which supports this scenario.

regards!

/ole
eviware.com

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️Please mark my answer as a solution if it was helpful
Highlighted
Frequent Contributor

Re: Xpath assertion that contain more than 1 match

Hello @skillsoft 

 

Could you tell me how  I could add an XPath that says:

Response contains > 10 answers, not knowing what the answers are but one is expecting more then 10?

 

Thanks in advance,

Kind regards,

AboveAndBeyond

Highlighted
Community Hero

Re: Xpath assertion that contain more than 1 match

May be you could consider creating a new thread with specifics of the use case along with sample data.


Regards,
Rao.
Highlighted
Community Manager

Re: Xpath assertion that contain more than 1 match

For future reference:

The last question is discussed here:

https://community.smartbear.com/t5/SoapUI-Pro/Assertions-check-that-number-of-response-is-bigger-the...

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Top Kudoed Authors