I need to be able to put a Range into my Assertions
In order to be able to change Environments easily, I need to be able to put a Range into my Assertions for a TotalResults field. I have found references on the board to the ability to do this but I can't get the syntax quite right and there doesn't seem to be an example for exactly what I need.
Here is the tag for the aggregate I am targeting:
<ItemPage>
<FirstResult>1</FirstResult>
<ResultsReturned>19</ResultsReturned>
<TotalResults>190</TotalResults>
<Items>
Here is the Assertion I currently have without a Range:
XPath Expression -
declare namespace ns1='http://ws.ussco.com/eCatalog/catalog/1';
//ns1:getSearchResponse[1]/ns1:searchResponse[1]/ns1:ItemPage[1]/ns1:TotalResults[1]/text()
Expected Result -
${DataSource RedPen SmallBS#totalResults}
DataSource RedPen SmallBS#totalResults
190
What I would like to see is a + or - tolerance of 5%. I have tried things like two Assertions ">= 181" and "<=200", or "greater than or equal to 181" and "less than or equal to 200". I have tried one Assertion "Between 181 and 200", and so on.
Can someone help me with the exact syntax?
Thanks,
Laura
Endpoint:
That got me close enough. Here is what I did. Two assertions:
Lower End of the Range:
XPath Expression:
declare namespace ns1='http://ws.ussco.com/eCatalog/catalog/1';
${DataSource RedPen SmallBS#totalResultsLowerRange} <= //ns1:getSearchResponse[1]/ns1:searchResponse[1]/ns1:ItemPage[1]/ns1:TotalResults[1]Expected Result:
true
Upper End of the Range:
declare namespace ns1='http://ws.ussco.com/eCatalog/catalog/1';
${DataSource RedPen SmallBS#totalResultsUpperRange} >= //ns1:getSearchResponse[1]/ns1:searchResponse[1]/ns1:ItemPage[1]/ns1:TotalResults[1]Expected Result:
true
And then all the Requests in my data set don't have to match exactly.
Thanks for giving me both methods!
Laura