cancel
Showing results for 
Search instead for 
Did you mean: 

resultset list assertions

Contributor

resultset list assertions

Hi,

i am doing some assertions for a resultset that is a list that looks like this:


 
    Users
 

 
    Global_Codes
 

 
    Global_Subscribe
 



now depending on the GUID in the database the order of the items change.

is there a assertion except "Contains" that validates for the items and doesnt care about the order?

i tried match content and Xpath match bot both are failing when the order changes.

thanks
Christoph
3 REPLIES 3
Super Contributor

Re: resultset list assertions

Hi Christoph,

you can use the XQuery assertion for this; create an XQuery that selects an ordered list of the items you want to test, and specify the expected results..

Get to grips with XQuery with something like http://www.w3schools.com/xquery/default.asp

regards,

/Ole
eviware.com
Contributor

Re: resultset list assertions

Thanks Ole,

this is working great now. here is the exact result and the according XQuery:


       
            Successful
           
           
           
           
           
 
    Users
 

 
    Global_Codes
 

 
    Global_Subscribe
 



XQuery:

declare namespace a='http://schemas.datacontract.org/2004/07/SecondTravel.Global.DataContract.Licence.v1_0';
declare namespace ns1='http://SecondTravel.Global.ServiceContract.Licence.v1_0Package.ILicencePackage';

{
for $z in //ns1:GetListResult/a:ResultSet/a:LicenceDCResultItem/a:FunctionalityCode/text()
order by $z return {data($z)}
}


this returns all functionalitycodes in a ordered list that then is compared with the expected result (in the same ordered list)

hope this helps others finding into XQuery faster

regards Christoph
Super Contributor

Re: resultset list assertions

cool! Thanks for sharing!

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors