Forum Discussion

austino's avatar
austino
Contributor
10 years ago

Rest Response - How Do I Change A Rest Response to XPATH?

On my project there are 2 QA's. One updated to 5.1.2, and I stayed on 4.6.4. We have just under 1000 assertions using XPATH for REST services, however, in 5.1.2, the response is only coming back as JSON so all of our XPATH assertions are failing. Is there a way to change the response back to XPATH so our assertions work in 5.1.2? We mainly use the outline view and then the "Assert" dropdown menu for Content. Any help is appreciated!

2 Replies

  • Doesn't look like there is a solution to this from what I can tell. We are in the process of updating all of our assertions and property transfers to use JSONPATH. While it is unfortunate due to the wasted time, JSONPATH is clearly a much better option for REST services, so if anyone reading this, use JSONPATH going forward - it is much easier than Xpath.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    There has been a change after 4.6.4 where a namespace was attached to the XML response. Since a namespace doesn't matter if you're getting a JSON response, it was no longer used in 5.0.0, or rather a default namespace was attached to every request's XML form. If your XPATH had a reference to a dynamic namespace, it would have required an update of the assertions to continue using XPATH. But now the JSONPath assertions are available in 5.1.2.

    Regards,

    Giscard
    SmartBear Support