Unanswered question

how can i pass a list of users (id , mail , password ) when invoking StartTest api with postman ?

i'm trying to launch my scripts with apis , so in my scripts i m using a list that contains data and information of my users account (id , mail , password ) , i tried to start my test with StartTest api and with a body that contains

{
"d": {
"ScenarioName": "scenario1",
"Description": "Testing rest api",
"NLWeb": false,
"Variables": "{\"env\"=\"xxxx\",\"Host\"=\"xxxxx\",
\"Users\"='[{\"id\":\"xxxx",\"password\":\"xxxx\",\"mail\":\"xxxx\"}]'}",
"Debug": false,
"TestResultName": "xxxx"
}
}

an exception was thrown :

Variable Users is not a constant

what should i do to resolve this issue ?

mohamed Y.
mohamed Y.

mohamed Y.

Level
0
76 / 100
points

Answers

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

What is the error returned by the API?

What do you mean by "Variable Users is not a constant"?

mohamed Y.
mohamed Y.

mohamed Y.

Level
0
76 / 100
points

in request body i have a json that contains a variable named "Users" of type list , so when i tried send the request ( Check the first description ) an exception was thrown
i want to pass a variable of type list when i start the test

this is the error :
2020/11/04 15:18:00 ERROR - neoload.Gui: An error occurred while preparing the scenario for testing. For more information, see the log file.
2020/11/04 15:19:20 INFO - neoload.Configuration: The project delete_project was successfully saved in 0.315 sec.
2020/11/04 15:19:38 INFO - neoload.Configuration: The project delete_project was successfully saved in 0.231 sec.
2020/11/04 15:19:56 ERROR - neoload.Runtime: Scenario manager failed to prepare bench:85818e1c-96a9-4ff5-ac2e-4b05b7d597ca com.neotys.nl.launcher.d.b: Variable Users is not a constant.
at com.neotys.nl.controller.d.a.b.d.a(d.java:3466)
at com.neotys.nl.controller.d.a.b.d.a(d.java:3443)
at com.neotys.nl.controller.d.a.b.d.a(d.java:670)
at com.neotys.nl.controller.q.ai.a(ai.java:818)
at com.neotys.nl.gui.a.e.run(e.java:347)
at java.lang.Thread.run(Thread.java:748)

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

The goal of the Variables fields in that REST call to start the test is to override existing constant variables like you can do in command line. You can't use other type of variables since it's not the purpose of that functionality.

I do not understand your goal with your type list variable. Your list variable should be created on your project so what is your goal here?

mohamed Y.
mohamed Y.

mohamed Y.

Level
0
76 / 100
points

the neoload project i will run it from a vm, so i m trying to run a group of users each time to test the performance,
so i need to pass my list type variable in the api if i am going to add another user.
I already have a list variable in my project but in case I am going to make a modification on the list, I am trying to find a solution to pass this variable with api, that my goal, because for the case of modification I will manually change the project and re import it in vm and that's not the right solution

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

As you understood the purpose of that variables parameter is not to modify a list type variable but a constant variable.

What about using a File variable instead of a list? That way you could only modify the file used by your variables without opening your project.