When I use pre-defined variables in request body value of parameter in request in runner is incorrect
I am attaching screenshots to explain.
variable in body:
and Response in Runner:
Why is it? Why value in request does not match the actual sent value? It restarts the variable generation?
Is it a bug?
This will be down to the specific API. The API will determine what is returned.
Do you have documentation for this API?
Is it an in-house developed API, or it looks like a faker\mock library.
If its a fake\mock library. What are the matching rules that define what is returned?
As a test, change the dynamic variable to something static. You could use “interface” again, and see what is returned. I suspect it will be the same, so the problem isn’t with the dynamic variable.
to illustrate this case, I took this API
but I noticed the same behavior when working with my API
When I use static value it is correct
But if I use any random value, when I run request by Runner, it show incorrect Request value
By looking at the console logs. In the second screenshot, it appears that “mobile” was sent instead of “virtual”. The console log is probably going to be king here.
Can you clear the console logs, and run a single request (not via the runner) and then check the console log for the request and response. Do they match?
Then use the collection runner and again check the console log to see what was sent and received, and then match against the collection runner logs.
It looks like the console log is showing the correct details, and the collection runner log is showing something else.
Oh, sorry, misunderstanding. There is two different request:
- From Runner to show incorrect value - “virtual”. When value was “online”.
- From tab with Request to show that API works fine, console shows correct value that match the actual value - “mobile”.
It looks like when its run in the runner, the details in the console log are different to what is being recorded in the “persist details” screen.
The request and response in the console logs are consistent.
I don’t know why they are showing different details. I only noticed that you didn’t save the request before running it the final time.
When I didn’t choose “Persist responses for a session”, whatever values are different. But in this case I can’t see Request runner log, only Response that incorrect
Were you rerunning the runner, after making a change in the request tab?
Unless you save the changes in the request, the runner won’t pick up that change and would still be using the old saved value.
Enabling the Autosave will help here:
Yes, I always push Ctrl+S after make change. Otherwise the request would have remained static data (in this case, screencast may show)
But I tried Autosave and this solve the problem