In a pre-request script I want to set a variable to use then in my request. Let's say my pre-request script looks like this:
var token = "x";
variables.set("token", token);
And if I want to use the variable {{token}} in the request itself, I am getting error: Request failed to set 'body' — Variable 'token' was not defined
Release :
Component : BLAZEMETER PERFORMANCE TESTING
We can not use the variable created in pre-request scripts in same request. Because the requests template is already prepared in backend. So, the created variable can be used in further steps.
Please find more details from below documentation. Let me know if you have any further questions.
https://guide.blazemeter.com/hc/en-us/articles/360001822737