Forum Discussion

MaksimSuperfin's avatar
New Contributor
7 years ago

Best practice for support both XML and JSON tests



We have web service that returns data in JSON and XML formats.
To get response in XML format user need to add header "Accept" with value "application/xml" into request (it is supported by our server).
Can you please advice best practice from the point of SoapUI test project how to support checking results of both formates and avoid test duplication?
Currently we have tests in JSON. We run groovy script util that transform JSON test case into XML test case. So we have 2 tests (one tocheck JSON and one to check XML format) that doesn't look for us efficient and we want to do something like this:


" have some kind of listener with global parameter which can switch between json or xml and by that to remove the need of tests duplication for xml support
i.e in case isXML global parameter is true we'll have a listener which will validate all the responses return with xml content header and then parse the response to json format"


Is it possible? I am not sure how to apply all existed JSON assertions of response after transformation of XML response into JSON response.
Do we have any chance to avoid support of test duplication?


Thank you,

No RepliesBe the first to reply