Forum Discussion
electric_Insura
14 years agoContributor
XML:
Groovy script below. As you can see, I'm expanding all of the Datasource properties that I will need for that particular assertion. If I wanted to check PTD_ANIMAL_BREED, I'd be expanding all of the Datasource properties named PTD_ANIMAL_BREED_x.
<Results>
<ResultSet fetchSize="0">
<Row rowNumber="1">
<PTD_POLICY_NUMBER>IF44514H7</PTD_POLICY_NUMBER>
<PTD_DATE/>
<PTD_ANIMAL_TYPE>A</PTD_ANIMAL_TYPE>
<PTD_ANIMAL_BREED>18</PTD_ANIMAL_BREED>
<PTD_ANIMAL_COUNT>1</PTD_ANIMAL_COUNT>
<PTD_POLICYHOLDER_SSN>918179825</PTD_POLICYHOLDER_SSN>
<PTD_REC_CREATE_DATE>20110912</PTD_REC_CREATE_DATE>
</Row>
<Row rowNumber="2">
<PTD_POLICY_NUMBER>IF44514H7</PTD_POLICY_NUMBER>
<PTD_DATE/>
<PTD_ANIMAL_TYPE>B</PTD_ANIMAL_TYPE>
<PTD_ANIMAL_BREED>05</PTD_ANIMAL_BREED>
<PTD_ANIMAL_COUNT>1</PTD_ANIMAL_COUNT>
<PTD_POLICYHOLDER_SSN>918179825</PTD_POLICYHOLDER_SSN>
<PTD_REC_CREATE_DATE>20110912</PTD_REC_CREATE_DATE>
</Row>
</ResultSet>
</Results>
Groovy script below. As you can see, I'm expanding all of the Datasource properties that I will need for that particular assertion. If I wanted to check PTD_ANIMAL_BREED, I'd be expanding all of the Datasource properties named PTD_ANIMAL_BREED_x.
def pTD_ANIMAL_TYPE_0 = context.expand( '${DataSource#PTD_ANIMAL_TYPE_0}' )
def pTD_ANIMAL_TYPE_1 = context.expand( '${DataSource#PTD_ANIMAL_TYPE_1}' )
def expectedAnimalTypes = [pTD_ANIMAL_TYPE_0, pTD_ANIMAL_TYPE_1]
def responseAsXml = context.expand( '${JDBC Request#ResponseAsXml}' )
def results = new XmlSlurper().parseText(responseAsXml)
...