When I use the xpath assertion with the function true(), it works fine, the result is obviously true.
But when I want to use the function matches("abracadabra", "bra") as it is stated here XQuery 1.0 and XPath 2.0 Functions and Operators (SecondEdition) (which also should return true), it always returns false, why?
In the Evaluate XPath assertion change the XPath Version to 2.0 and it will succeed and return true
I already have the version set to 2.0, but I found out what the problem was: In my test case the response message was not set. So I manually added the following string to the response message:
<?xml version="1.0" encoding="UTF-8"?><a></a>
After this, the xpath matched.
Yes, the target message of xpath needs to be an xml message to make xpath work. Besides the default response, you can also use a context variable.