header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
September 08, 2008, 04:52:42 am
Username: Password:
Login with username, password and session length

Forgot your password?
 
resultset list assertions
Welcome, Guest. Please login or register.
September 08, 2008, 04:52:42 am
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  resultset list assertions
« previous next »
Pages: [1] Print
Author Topic: resultset list assertions  (Read 304 times)
Christoph Schwarz
Newbie
*
Posts: 15


« on: April 29, 2008, 03:27:10 pm »

Hi,

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

<a:ResultSet xmlns:a="http://schemas.datacontract.org/2004/07/SecondTravel.Global.DataContract.Licence.v1_0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://SecondTravel.Global.ServiceContract.Licence.v1_0.ILicence" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <a:LicenceDCResultItem>
    <a:FunctionalityCode>Users</a:FunctionalityCode>
  </a:LicenceDCResultItem>
  <a:LicenceDCResultItem>
    <a:FunctionalityCode>Global_Codes</a:FunctionalityCode>
  </a:LicenceDCResultItem>
  <a:LicenceDCResultItem>
    <a:FunctionalityCode>Global_Subscribe</a:FunctionalityCode>
  </a:LicenceDCResultItem>
</a:ResultSet>

now depending on the GUID in the database the order of the <a:FunctionalityCode> 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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,210


« Reply #1 on: April 29, 2008, 03:41:10 pm »

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
Logged
Christoph Schwarz
Newbie
*
Posts: 15


« Reply #2 on: May 07, 2008, 04:50:26 pm »

Thanks Ole,

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

<GetListResponse xmlns="http://SecondTravel.Global.ServiceContract.Licence.v1_0Package.ILicencePackage">
         <GetListResult xmlns:a="http://schemas.datacontract.org/2004/07/SecondTravel.Global.DataContract.Licence.v1_0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <ResultCode xmlns="http://schemas.datacontract.org/2004/07/SecondTravel.Library.Instrumentation.Errors">Successful</ResultCode>
            <Errors xmlns="http://schemas.datacontract.org/2004/07/SecondTravel.Library.Instrumentation.Errors"/>
            <Infos xmlns="http://schemas.datacontract.org/2004/07/SecondTravel.Library.Instrumentation.Errors"/>
            <Warnings xmlns="http://schemas.datacontract.org/2004/07/SecondTravel.Library.Instrumentation.Errors"/>
            <TransactionHandleName xmlns="http://schemas.datacontract.org/2004/07/SecondTravel.Library.Instrumentation.Errors"/>
            <a:ResultSet xmlns:a="http://schemas.datacontract.org/2004/07/SecondTravel.Global.DataContract.Licence.v1_0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://SecondTravel.Global.ServiceContract.Licence.v1_0.ILicence" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
                    <a:LicenceDCResultItem>
                      <a:FunctionalityCode>Users</a:FunctionalityCode>
                    </a:LicenceDCResultItem>
                    <a:LicenceDCResultItem>
                      <a:FunctionalityCode>Global_Codes</a:FunctionalityCode>
                    </a:LicenceDCResultItem>
                    <a:LicenceDCResultItem>
                      <a:FunctionalityCode>Global_Subscribe</a:FunctionalityCode>
                    </a:LicenceDCResultItem>
                  </a:ResultSet>

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';
<Licences>
{
for $z in //ns1:GetListResult/a:ResultSet/a:LicenceDCResultItem/a:FunctionalityCode/text()
order by $z return <FunctionalityCodes>{data($z)}</FunctionalityCodes>
}
</Licences>

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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,210


« Reply #3 on: May 08, 2008, 02:21:47 am »

cool! Thanks for sharing!

/Ole
eviware.com
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header