2

I'm using runscope and am facing a problem with using variables in xpath. Imagine I receive a response in the XML form and wish to check if /AllTickets/Ticket[TicketId/text()=12345]/Name/text() is equal to somename.

It works just fine, as long as I use hardcoded values. However, I'd like to be able to pass the value of TicketId as a variable and cannot do that - apparently the variable ticket_id (defined earlier in the test) cannot be substituted with its value.

That's what I tried:

/AllTickets/Ticket[TicketId/text()={{ticket_id}}]/Name/text()
or
/AllTickets/Ticket[TicketId/text()=$ticket_id]/Name/text()

There's no problem with the variable itself - if I try to use it in the expected results of the Assertions section, it's substituted just fine.

So, the question is: how can I use variables in xpath part of the XML verification?

Richard Erickson
  • 2,568
  • 8
  • 26
  • 39
  • I don't think we support variables in the property of an assertion. We can look into this, but can you email help@runscope.com with a shared result we can take a closer look at? – John Sheehan May 11 '16 at 17:26

0 Answers0