Ask a Question

Xpath assertion that contain more than 1 match

skillsoft
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

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. ⬇️⬇️⬇️
AAB
Regular 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

nmrao
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.
TanyaYatskovska
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 Yatskovskaya
SmartBear Community and Education Manager

Join Wintertainment 2021 to share your stories, have fun, earn community badges, and more!
cancel
Showing results for 
Search instead for 
Did you mean: