jpalmiero
11 years agoNew Contributor
Creating Assertions on RESTful url parameters
All,
We have a test step which is a RESTful request. the request looks something like this
GET https://somehost.somedomain.com/MarketD ... ata?req=Q&symbols=IBM%2CMSFT&qryOpts=
(NOTE, you can reqeust a comma seperatated list of stock quotes. in the example above, it is IBM,MSFT)
The result that we get back is XML with quote data:
<rjmktdata>
<quote rj_symbol="IBM" rj_typSpcl="Common Stock" .../>
<quote rj_symbol="MSFT" rj_typSpcl="Common Stock" .../>
</rjmktdata>
What we would like to do is ASSERT that we have as many quotes in the incoming response as we do in the outgoing request. If this was a SOAP reqeust, then it would be fairly straight forward to write the ASSERTION as xpath comparing the count of the ticker symbols in the request with the count of the response.
Does anyone know how do do this with a RESTful reqeust (ie count the URL parameters and compare them to the count of the elements in the response.)
We have a test step which is a RESTful request. the request looks something like this
GET https://somehost.somedomain.com/MarketD ... ata?req=Q&symbols=IBM%2CMSFT&qryOpts=
(NOTE, you can reqeust a comma seperatated list of stock quotes. in the example above, it is IBM,MSFT)
The result that we get back is XML with quote data:
<rjmktdata>
<quote rj_symbol="IBM" rj_typSpcl="Common Stock" .../>
<quote rj_symbol="MSFT" rj_typSpcl="Common Stock" .../>
</rjmktdata>
What we would like to do is ASSERT that we have as many quotes in the incoming response as we do in the outgoing request. If this was a SOAP reqeust, then it would be fairly straight forward to write the ASSERTION as xpath comparing the count of the ticker symbols in the request with the count of the response.
Does anyone know how do do this with a RESTful reqeust (ie count the URL parameters and compare them to the count of the elements in the response.)