Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Using {variables} in XPath Responder Correlation

Is it possible to use Responder Suite {variables] in the XPath Request Body correlation?

e.g. /:Envelope/:Body/:someRequest/:someNode/*:color/text()="{color}"

Comments

  • [Deleted User]
    [Deleted User] Posts: 0 admin

    Yes it is, the only thing that you need to make sure happens is to use the "${variable_name}" syntax.

    Do note though that if you fill in fields this way you will not be able to test your XPath in the editor, since the variable will only resolve at runtime or when your asset is invoked.

  • jefftuckerbofa
    jefftuckerbofa Posts: 234

    Thanks for the quick reply. I tried using "${color}" and it does not appear to be working. I get a 404 response showing that the match failed. The XPath in the "criteria" listed in the response shows the variable reference, not the expected value.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,
    I see the same thing when I try to use a variable in the xpath. Would a data source correlation work in your case? The "variable" would come from a row of data in the data source so it could match many different "colors"

  • jefftuckerbofa
    jefftuckerbofa Posts: 234

    Yes, that worked. Thanks guys. I added a datasource and used that for the correlation. Very cool.

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Happy to help!