Reputation: 1237
I have a question about user defined variable that I want to compare to field in Response:
I created Json Extractor
and put the value from the response that I need to check in a variable called CID
.
I have a user defined variable in the start of the test called Expected_CID
I Added response Assertion
In the response assertion I could find out how to compare CID
to Expected_CID
If I put the number it is working as expected but I want to use variable and not hard coded numbers.
Can someone please explain what I do wrong?
Upvotes: 2
Views: 1897
Reputation: 58882
To check variable in Response Assertion
you need to put variable name inside ${}, this way JMeter will know you want to check your variable value.
In your case use ${Expected_CID}
in Patterns to Test
Text area, If not working make sure you don't have extra spaces in its User Defined Variables
Value.
Notice in Response Assertion
's Jmeter Variable
you don't need to put variable name inside ${}, because it's expected for find variable.
A @UBIK LOAD PACK mention, notice that:
Variable names are case sensitive
.
Upvotes: 1
Reputation: 34566
Variable names are case sensitive.
So for example , if you called CID, then cid won't match.
So in Response Assertion:
Upvotes: 2