Forum Discussion

Teddy_Liu's avatar
Teddy_Liu
Occasional Contributor
16 years ago

a problem to add an Xpath assertion to a rest request

I am now doing rest test by using soapui. In this case, i post some thing to server. If there is no error by request, the server will send a response in XML back, as following:



if there is some wrong, the response will be

Place not found for placeId2000

So, i wanna insert such an Xpath assertion, 
//data[@contentType="null"]
that means, if the contentType is "null", then the request/response are right, otherwise, wrong.

But this assertion is always wrong, showed as "null/empty response"
and i think is a problem by

Does anyone has a good idea to ignore or maybe solve that problem.

Thanks in advance!!

1 Reply

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hello!

    Please try the following Xpath expression:
    "/data[1]/@contentType" with the expected Result being "null" (both without the quotes).
    This worked for me, using:

    <data contentType="null" contentLength="0"><![CDATA[]]></data>


    as the respose. Good luck!

    Regards,
    Dain
    eviware.com