Unanswered question

Share an extracted value across multiple User Paths

When writing test for API framework, I'll looking to reuse the API session key.

User Path 1
call https://mytesturl.com/api-1.4/services/rest/login/createS...
This hands me a key back in the response.
I toss that in a shared queue.

User Path 2

call https://mytesturl.com/api-1.4/services/rest/emp/getEMP

I pluck the session key from the queue and I get my response

So No I create a run time

it runs User Path 1 once
then runs User Path 2 ten times....
the first one works and the other 9 fail

I get a blank value back from my shared queue.

How can I make the shared queue be persistent? I add one value and the stays there?

Andrew P.
Andrew P.

Andrew P.

Level
0
61 / 100
points

Answers

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

a queue is pop a value on and pop it off when you consume it, it can't be consistant. Why not write it to a variable? or a file?

Andrew P.
Andrew P.

Andrew P.

Level
0
61 / 100
points

I tried that but it would not persist from one user path to the other.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

not if the variable was a constant in the variable manager? and you set it in javascript using setValue? my next suggestion would be write it to a file in the custom-resources folder. Why are you using different user paths, why not have the series of api calls in a single user path?

Andrew P.
Andrew P.

Andrew P.

Level
0
61 / 100
points

Setting it in js to a variable in NeoLoad variables did not work outside of the first user path. *BUT the write to the file works!.* I was just trying to cut down on work and calls to accomplished this. The goal was to get the session key once and not have to generate a new on for each user path. Thanks for the help Neil!

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

I assume the session key will expire though, if it's valid for an hour and you do a 2 hour test, things will go wrong once it expires. I would have the call in each user path, it could be a shared container, and maybe use a fork and a loop and just call the session api once every hour

Andrew P.
Andrew P.

Andrew P.

Level
0
61 / 100
points

Timeout is 30 min. But there is a "keepalive" call so that is how I will keep it going for longer tests.

Nouredine A.
Nouredine A.

Nouredine A.

Level
4
5000 / 5000
points
Team

I do not know if it would help but using the Javascript method peekSharedValue(String) you can get a value from the queue without deleting it. For more details about this method you can look at the NeoLoad documentation here