Search code examples
jmeterresponseassertiontext-extraction

Jmeter Response Assertion is failing upon getting from Reg Ex Value


Hello I have a scenario where I need to validate the extracted value from my regex, unfortunately I'm encountering an error upon using Response Assertion. I would like to seek assistance to any one of you. Your response is highly appreciated. Thank you so much in advance

I am able to extract my regex upon running, but I encounter upon using that on my Response Assertion.

Screenshot:

Response Screenshot

Response Assertion Failure

Response Assertion Configuration

Expected Result: I just want to validate "userId = 14534"


Solution

  • If you want to just check the presence of 14534 text in the response - just configure the Response Assertion as follows:

    enter image description here

    In case you want to check whether 1st row of the user_id column of your SQL query result set is equal to 14534:

    1. In the JDBC Request sampler define a variable name, i.e. user_id

      enter image description here

    2. Amend your Response Assertion configuration to Apply to a JMeter Variable called user_id_1:

      enter image description here

    More information: How to Use JMeter Assertions in Three Easy Steps