In SoapUI, I have a JDBC Test Step that returns the following data:
<Results>
<ResultSet fetchSize="128">
<Row rowNumber="1">
<ID>1</ID>
<NAME>TestName1</NAME>
<DESCRIPTION/>
<TYPE>Bool</TYPE>
<ISPRODUCTTAG>true</ISPRODUCTTAG>
<ISLOCATIONTAG>false</ISLOCATIONTAG>
<SUBSECTION>Default Sub Section</SUBSECTION>
<SECTION>Default Section</SECTION>
<SUBGROUP>Default Sub Group</SUBGROUP>
<GROUP>Default Group</GROUP>
</Row>
<Row rowNumber="2">
<ID>2</ID>
<NAME>TestName2</NAME>
<DESCRIPTION/>
<TYPE>Bool</TYPE>
<ISPRODUCTTAG>true</ISPRODUCTTAG>
<ISLOCATIONTAG>false</ISLOCATIONTAG>
<SUBSECTION>Default Sub Section</SUBSECTION>
<SECTION>Default Section</SECTION>
<SUBGROUP>Default Sub Group</SUBGROUP>
<GROUP>Default Group</GROUP>
</Row>
</Row>
</ResultSet>
I have an REST API XML Response that contains the following data:
<ArrayOfTagInfo>
<TagInfo id="1" name="TestName1" type="Bool" isProductTag="true" isLocationTag="false" subsection="Default Sub Section" section="Default Section" subgroup="Default Sub Group" group="Default Group"/>
<TagInfo id="2" name="TestName2" type="Bool" isProductTag="true" isLocationTag="false" subsection="Default Sub Section" section="Default Section" subgroup="Default Sub Group" group="Default Group"/>
</ArrayOfTagInfo>
I would like to be able to compare(assert) both the Database Values and the Response Values (response can be in XML or JSON depending on the Request Accept Header) using groovy arrays if possible as the data returned from the database can be very large.
Can anyone help?
If you have SoapUI-Pro, you should be able to accomplish all this with no Groovy.
You can design your test case with the following test steps:
The idea/sudo code here in groovy script step is that
Here goes the groovy script:
In the above, 3rd row is not matching, so assert will throw the following error:
If you remove 3rd (from both responses), then you do not see any error, which is indication of successful comparison of jdbc and json responses.