0
votes

What I am trying to achieve:

Insert records into Database and verify that the count of records inserted matches with the expected count.

Steps performed:

  • I have inserted 1 record into a database using a HTTP Request(API).
  • I have included a JDBC Request to return the count of records inserted in the database and stored the count * as RESULT
  • I have added the variable name in JDBC request as RESULT
  • I have created a response assertion in JDBC request and passed the 'JMeter Variable Name to use' as RESULT
  • Selected the 'field to test' as 'Text Response'
  • 'Pattern Matching Rules' as 'Equal'
  • 'Patterns to Test' as '{Result=1}'
  • Executed the script

Assertion Result:

Assertion error: false Assertion failure : true Assertion failure message: Test failed: variable(RESULT)expected to equal/

*******received : [[[[{RESULT=1}]]]] *******comparison: [[[{RESULT=1} ]]]

If this issue is resolved, I want to increment the count. Please advise.

1

1 Answers

0
votes

When using the JDBC Requests, your variables are returned like this: RESULT_1, RESULT_2 and so on..so your variable is actually RESULT_1. So the short answer would be like this:

In the Response Assertion you have to do the following:

  1. 'JMeter Variable' as RESULT_1
  2. Select the 'field to test' as 'Text Response'
  3. 'Pattern Matching Rules' as 'Equals'
  4. 'Patterns to Test' as '1'
  5. Execute the script

enter image description here