Verification tab can't recognise defined variable


#1

Hi,
Rencently, I am working on API testing and found below issue.
I want to parameterize my request with this syntax
{
“name”: “${userName}”,
“job”: “zion resident”
}


And I also add variable tab

And I tried below syntax in verification tab
WS.verifyElementPropertyValue(response, ‘name’, userName)
Verification
But test case always failed with below message.

I even tried “WS.verifyElementPropertyValue(response, ‘name’, “${userName}”)”, it still failed.
Does this mean verification tab can’t recognise variable? BTW, globalvariable is working.


#2

In the Verification TAB there is a code SNIPPET for “Get a variable” which goes likes this:

def variables = request.getVariables()
def variable = variables.get(‘userName’)
println(variable)


#3

Thanks!!! It works.