How to get API response XML values in to variables in Jmeter tool? see bold color values. my plan is to assign those variables in to response assertion > 'pattern to test' for match with DB values(using Jmeter variable which comes in JDBC Response).

enter image description here

enter image description here enter image description here

1 Answer 1

  1. Extract the value from XML using XPath Extractor, the relevant XPath query would be something like //Product/Id/text()

    JMeter XPath Extractor Demo

  2. Once done you will be able to compare 2 JMeter Variables:

    • the one from the XPath Extractor
    • with the one from the JDBC Request sampler

      using Response Assertion configured like:

      • Apply to -> JMeter Variable -> Reference name, used in the XPath Extractor (NB: don't surround the variable with ${}, just put plain text there
      • Pattern Matching Rules: Equals
      • Patterns to Test: variable from the JDBC Request (NB this time you need to surround it with ${}, for example ${ID_1}

        JMeter Response Assertion on Variable


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.