Search code examples
jmeterjmeter-3.2

Comparing api request with jdbc values


I am doing api request automation using jmeter. i want to compare api request values with jdbc values after execution.how to do that?


Solution

    1. Add JDBC driver for your database to JMeter Classpath
    2. Add JDBC Connection Configuration to your Test Plan
    3. Add JDBC PostProcessor as a child of the HTTP Request and execute the relevant query to get the value from the DB and store result into a JMeter Variable
    4. Add JSON Extractor or XPath Extractor as a child of the request and fetch the value from the API response
    5. Compare the values from steps 3 and 4 using Response Assertion

    You can see How to Retrieve Database Data for API Testing with JMeter article for reference configuration.