Forum Discussion

keanesean's avatar
keanesean
Occasional Contributor
7 years ago

wildcard doesn't work for nil response

 Hi, 

 

I have XPath assertion for the response below. 

I am only concerned with the Activity and Agent values, so have wildcard enabled and use * for Reason. 

However if reason is returned as nil, this will fail assertion. Is there a way to include nil in the wildcard assertion?

Alternatively, is there a way to have an OR assertion that will allow me to say 'nil OR *'?

 

<Log>
<Activity>Deactivated</Activity>
<Reason xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<Agent>XXX</Agent>
<PerformedAt>2017-11-06T01:32:16Z</PerformedAt>
</Log>

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    You mean just value of the element nil or don't get response at all?

    Any ways, you will have better control if you use Script Assertion.
      • PaulMS's avatar
        PaulMS
        Super Contributor

        You could also use 2 separate assertions with XPath expressions //Log/Activity and //Log/Agent