Unanswered question

how can i update the variable during application working

Hi, I create a command line action and this action create random number and write into the a.txt file. After that I can catch this random number in a.txt file with variable manager(file variable). when I run project I need this variable to use at the next action. The problem is How can I update the variable during project running. I tried varible modify but it did not work. it uptade after end of project check. Do you any suggestion? Thanks a lot.

Enes E.
Enes E.

Enes E.

Level
0
43 / 100
points

Answers

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

okay, so you cannot update the content of the file, when the test is ran, the file content is read in at the beginning of the test and held in memory so it is effectively static data. The real question is why are you doing this? in the Variable Manager, you can use the random integer variable type, you set min/max value and a random number is generated within this range. You can also decide when does the value get regenerated, on each use, once per page, once per virtual user, etc. Hope this helps

Enes E.
Enes E.

Enes E.

Level
0
43 / 100
points

You misunderstand me. I can update the content during project running. İt is the first action of project. I want to use this updated variable at the next action. The next action does not catch the updated one. How can I get updated content(in a.txt file) at the second action?

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

I understand that and yes, you can update the file during the test in the first action but Neoload has already read in teh file content and cached it so subsequent updates wont be seen. Have you looked at the random integer variable type?

Enes E.
Enes E.

Enes E.

Level
0
43 / 100
points

Hmm I did not write completely right. This variable contains various characters like number letter symbol. So I have to get this variable from txt file after update it. Thank you :)

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

I would look at the javascript variable in Neoload then, it looks like and is treated as a variable but actually it is running some javascript code. This code could access the file and read in the content

Enes E.
Enes E.

Enes E.

Level
0
43 / 100
points

It can work, I hope. Do you know how can I write the code? Can you write a sample?

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team