Answered question

How to use a value captured in a JavaScript?

I have a result of a function in a NeoLoad variable inside my Javascript:

context.variableManager.setValue("body", body);

How can I use this variable in a Method: Post and Content Type: text ?

I tried with ${body} in the Text Content but it does not work.

Thanks

Begona P.
Begona P.

Begona P.

Level
0
22 / 100
points

Did you find this useful ?

No (0)

Yes (0)

0% of users found this answer useful

Other answers

It is the right way to use your variable. When you say it does not work do you mean that the variable is not replaced while replaying your request?

Could you provide some screen shots describing that behavior?

Begona P.
Begona P.

Begona P.

Level
0
22 / 100
points

As you can see, I execute de JS named "JavaScriptGeneratingBody", (attached the code in the below image). The response generates 400 error.
What I want is generate 10 random json. The variables "randomAccountNumber", "randomBalance"... work perfectly. The problem is when I try to capture the variable "body".
Thanks

Begona P.
Begona P.

Begona P.

Level
0
22 / 100
points

This is the solution, deleting the the line of the evaluate function works fine.
Thanks a lot!