This issue we faced while API Test Automation design. In our web service testing we trigger the API request (north bound) and checks the downstream request formed by application code. We use mocked backend using wiremock. Wiremock has capability equalToXml which support the matching of incoming request and expected request and thus test is validated.
Issue is while xml comparison using ${xmlunit.ignore} placeholder we are able to ignore the values from single node but not able to ignore anything entirely present under a particular node if that node has child nodes.
This would help in xml comparisons when some part in request is unknown or under development or its dynamic and of no interest for comparison etc. Issues was raised on wiremock project #1741 but later found that wiremock is using xmlunit as dependency.
Example:
<device>
<deviceType>Mobile</deviceType>
<IMEI>12345678912345</IMEI>
<deviceName>My Samsung</deviceName>
</device>
Above incoming request will match with
<device>
<deviceType>Mobile</deviceType>
<IMEI>${xmlunit.ignore}</IMEI>
<deviceName>${xmlunit.ignore}</deviceName>
</device>
/*****************************************************************/
But incoming request
<device>
<deviceType>Mobile</deviceType>
<deviceDetails>
<IMEI>12345678912345</IMEI>
<deviceName>My Samsung</deviceName>
</deviceDetails>
</device>
OR
<device>
<deviceType>Mobile</deviceType>
<deviceDetails>
<IMEI>12345678912345</IMEI>
<deviceName>My Samsung</deviceName>
<deviceSerialNumber>XYZ-123</deviceSerialNumber>
</deviceDetails>
</device>
does not match with
<device>
<deviceType>Mobile</deviceType>
<deviceDetails>${xmlunit.ignore}</deviceDetails>
</device>
This issue we faced while API Test Automation design. In our web service testing we trigger the API request (north bound) and checks the downstream request formed by application code. We use mocked backend using wiremock. Wiremock has capability equalToXml which support the matching of incoming request and expected request and thus test is validated.
Issue is while xml comparison using ${xmlunit.ignore} placeholder we are able to ignore the values from single node but not able to ignore anything entirely present under a particular node if that node has child nodes.
This would help in xml comparisons when some part in request is unknown or under development or its dynamic and of no interest for comparison etc. Issues was raised on wiremock project #1741 but later found that wiremock is using xmlunit as dependency.
Example: