How to use variable in test param

Hey,
i’m have a variable saved in common variables
and i wan’t to test is the output in get is same as the variable
but i keep getting undefiled errors
image
image
Maybe someone can advice
Thank you

Hi @JuliaKaplan
You should get the value from the environment variables to use it in a test script.
Refer this on how to get the value and use it in the test.

From the screenshot, i see that you are trying to access the variable value SdrVersionNumber from global variables. Use the below code in tests script.

var body = pm.response.json();
var expectedValue = pm.globals.get("SdrVersionNumber");
pm.expect(body.SdrVersion).to.eql(expectedValue);
1 Like

Thank you very much! it worked :slight_smile: