martonjurak
6 years agoOccasional Contributor
JDBC script assertion
Hi,
I have a jdbc request where the result is the following:
<Results> <ResultSet fetchSize="10"> <Row rowNumber="1"> <STATUS_ID/> </Row> <Row rowNumber="2"> ...
- 6 years ago
Below script assertion should help you:
/** * Script Assertion for the JDBC Request Test step **/
assert context.response, 'Response is empty or null' def xml = new XmlSlurper().parseText(context.response) def validList = ['20', ''] def statusIds = xml.'**'.findAll {'STATUS_ID' == it.name() }*.text() assert statusIds.every{ it in validList}, 'Invalid values present in the response for Status Ids'