2
votes
  1. I've added a User Defined Variables element

    • Then created a variable ${Parameter} with value "123456" and passed it in a GET request.
    • Created a second variable ${Response} with value "Invalid code 123456"
  2. I've added a Response Assertion element

    • Added the ${Response} variable to the Response Assertion

When I send the request like this, everything is fine. But if I add the second variable in the value field, then an Assertion error is returned.

What I'm trying to do is to add a variable to the value field of an already existing variable: e.g. Set the Value of the ${Response} variable as "Invalid code ${Parameter}"

How can I achieve this in jmeter?

1

1 Answers

0
votes

Why are you unnecessarily making the things complex!

You can directly use the value you want to assert in the Response Assertion.

Keep as follows:

Invalid code ${Parameter}

Here, ${Parameter} value be evaluated first and checked against the response.


Just incase, if you want to use JMeter variable as value to another JMeter variable, use as follows, using ${__evalVar()}:

Invalid code ${__evalVar(Parameter)}

Note: observed that if you define both the variables in the same UDV, Parameter value is empty. So, add two UDVs and define Parameter in the first UDV and Response in the second UDV with above value.