Department_of_T
11 years agoContributor
Contains Group Assertion
I need to add an assertion that returns true if the element and its value exists in the response and this value matches a JDBC response. But i need the assertion to pass if the element is missing and the response back from JDBC is null (empty string value). Quite often a valid scenario is that some elements are missing from the response.
I tried doing this with a Conditional Group Assertion
1)Contains assertion to verify the element exists
2)XPATH assertion to verify value matches the JBDC call.
Question:
1)How can i edit the XPATH assertion for the boolean to return a blank value eg " " which matches the value of JDBC instead of returning false?
2)If there an easier way to do this assertion without grouping the assertions?
-------------------
CONTAINS ASSERTION:
XPATH EXPRESSION
XPATH EXPECTED RESULT
--PART OF RESPONSE--
I tried doing this with a Conditional Group Assertion
1)Contains assertion to verify the element exists
2)XPATH assertion to verify value matches the JBDC call.
Question:
1)How can i edit the XPATH assertion for the boolean to return a blank value eg " " which matches the value of JDBC instead of returning false?
2)If there an easier way to do this assertion without grouping the assertions?
-------------------
CONTAINS ASSERTION:
(?s).*<postalAddress>.*<nationalPostalAddress>.*<firstAddressLine>.*
XPATH EXPRESSION
declare namespace ns0='http://transport.wa.gov.au/apo-ws/';
boolean(//ns0:findVehicleRegistrationRenewalResponse[1]/findVehicleRegistrationRenewalResponse[1]/postalAddress[1]/nationalPostalAddress[1]/firstAddressLine[1])
XPATH EXPECTED RESULT
${FindPersonCurrentVehOwner - JDBC#ResponseAsXml#//Results[1]/ResultSet[1]/Row[1]/POSADDRLINE1[1]}
--PART OF RESPONSE--
<residentialAddress>
<firstAddressLine>233 ROYAL ST</firstAddressLine>
<secondAddressLine/>
<postcode>6060</postcode>
<suburb>YOKINE</suburb>
<stateOrTerritoryCode>WA</stateOrTerritoryCode>
</residentialAddress>
<postalAddress>
<nationalPostalAddress/>
<overseasPostalAddress>
<firstAddressLine>10/79 BESSELL AVENUE</firstAddressLine>
<secondAddressLine/>
<postcode>6152</postcode>
<townCity>COMO</townCity>
<countryCode>AU</countryCode>
</overseasPostalAddress>
</postalAddress>