0

I am setting some values in database using REST request via JMeter and I want to verify the set values are committed into database. I'm able to access mysql database using JDBC driver in JMeter however I don't know how to compare the output? The JDBC output is shown within JMeter.

1 Answer 1

3

You need to use one of JMeter Assertions which are designed to check if returned data matches your test case.

I would do it as follows:

  1. Update something via REST API call by using a JMEter variable i.e. EXPECTED
  2. Fetch information from the database via JDBC Request and store in to another JMeter variable, i.e. ACTUAL
  3. Use i.e. Beanshell Assertion to compare 2 variables.

Example Beanshell Assertion code:

String expected = vars.get("EXPECTED");
String actual = vars.get("ACTUAL");

if (expected.equals(actual))
{
    Failure = false;
}

else
{
    Failure = true;
    FailureMessage = "Difference detected, expected: " + expected + " and actual: " +     actual;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .