Problem with the verifyEval command

I’m attempting to compare the contents of two variables with the verifyEval command using the following syntax: verifyEval | storedVars[‘month’]==storedVars[‘month1’] | true. Upon execution of the test case, the verifyEval commands fail with ‘[error] did not match’. However, if I execute the single verifyEval command, it succeeds. Any reason this command isn’t working during execution of the test case?

I think the problem might actually have to do with storedVars. I was having the same issue (I even echoed var1 and var2 to make sure they were the same value), but when I changed the Target to be ${var1}==${var2}, it worked.

Ok, I’ll try that. Thanks!

That worked! Thank you for the tip!

Well now this isn’t working any longer. The statement: verifyEval | ${state}==${state1} | true
fails with the following error: [error] Threw an exception: Unexpected token {
Any ideas what is causing this? Is the verifyEval command the best one to use for comparing the contents of two variables?

1 Like

Now I’m receiving this error:
[info] Executing: | verifyEval | ${state}==${state1} | true |
[info] Expand variable ‘${state}==${state1}’ into ‘MD==MD’
[error] Threw an exception: MD is not defined

I just checkedJeff Sharp said:

Well now this isn’t working any longer. The statement: verifyEval | ${state}==${state1} | true
fails with the following error: [error] Threw an exception: Unexpected token {
Any ideas what is causing this? Is the verifyEval command the best one to use for comparing the contents of two variables?

I just tried this and it works

The trick is that there must not be any spaces in the Javascript otherwise it will throw this “unexpected token” error.

${var1}==${var2}

If you are checking strings use:
“${var1}”=="${var2}"

The tricky part is that when you are editing be careful not to click on this line and then run, sometimes that will add the extra spaces automatically and then it will fail.