Forum Discussion

shales's avatar
shales
Occasional Contributor
6 years ago

Message Content Assertion: Assertion is looking for null fields even though it worked previously

When I run my call I get the following JSON object: { "data": { "id": 159, "zoneName": "NameofZone", "createdAt": "2019-09-11 19:25:31", "updatedAt": "2019-09-11 19:25:31", "groupsId": null ...
  • shales's avatar
    shales
    6 years ago

    The dev team got back to me today.  The issue is with the URL.  Since this is a call that requires a template parameter for the ID, when the assert is created it is created with the ID in the URL.  When I run the test from the test suite level, a new group is created, thus a new group ID is created which does not match the ID listed in the URL for the content assert.  Below is the direct reply from the team:

    Message Content Assertion is based on xml object and it converts all json nodes into xml nodes and declares namespace ns1=endpoint.
    When the assertion was created the endpoint was http://{APIURL}/api/zones/165.
    If you open XML tab in the response you will see something like <Response xmlns="http://{APIURL}/api/zones/179">. And the namespase for the got response and in the assertion are different, that's why the assertion fails.
    The node cannot be found at all

    They suggested to substitute the assertion for the JSONPath Existence Match which is more preferable for json responses and independent of endpoint.