Unanswered question

Javascript created to write file with variable, but not saving data into csv when runing from load agents.

Question 1:

Created a javascript to write variables into csv file, working fine when run from localhost agent,

But when run from load agent, the csv file is not getting updated.

Question 2:
how to write a javascript that can delete a row from csv after using the row during the run time or end of the run delete all rows which are used. So need javascript that can delete number of rows from csv.

Please provide your inputs.

Thanks in advance!!!

venkata S.
venkata S.

venkata S.

Level
0
47 / 100
points

Answers

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

Where are you expecting the LGs to write their files to, the controllers C drive or their own, also don't forget it's the VUs writing the files so 500vu might all be overwriting the same file, so conflicts?

You should google javascript to delete from the files but my question would be why not use shared queues?

venkata S.
venkata S.

venkata S.

Level
0
47 / 100
points

Neil W.,
I want the LGs to update the file on Controller machine in any drive/location using JavaScript.

Shared queues working, but we need to delete the used data from file using JavaScript. So I am looking a JavaScript that can delete the data from row 1 to 1000 after used 1000 rows. So need a javascript for this.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

Rows will be deleted from share queues as they are used. I think having 1000s of vu's all changing a single file on a shared drive that happens to be on the controller would add to the network traffic and you would get file access conflicts. If queues are not suitable I would suggest a database for test data

venkata S.
venkata S.

venkata S.

Level
0
47 / 100
points

Hi Neil W,
Much appreciate your inputs. As you said, "Rows will be deleted from share queues as they are used."

are you referring delete manually by editing the shared queue csv file, if yes, but we are looking to automate this step by configure jenkins job the script, so every time it will do create csv, edit, and delete rows based on the usage.

that's way I am looking to automate the process.

thanks.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

Neolaod will delete the values, think of the queue as a dynamic list, when values are popped off the queue and consumed, they are being removed/deleted, the temporary csv will be updated to reflect the queue. You don't need this code

venkata S.
venkata S.

venkata S.

Level
0
47 / 100
points

Hi Neil W,

Thanks your answer, well I don't know that shared queue delete the used data/row. If the queue is full as per the limit, it will ignore new data and the csv file won't update, any way we can increase share queue, but think about we run frequently these apis every week, so test data will be huge to maintain manually.

My actual requirement is, two individual API's, these can be run any time as need without any dependency one other. So once run api for create, I get new ids update in shared queue based on the limit of shared queue, those I use in cancel and deleting used data manually currently in the cancel.

so automate using jenkis cancel request API is only problem to use queue data and delete after used it individually.

so both create and cancel are not run one after, both are induvial apis run any time from jenkis job without any manual interaction for test data.

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

The limit can't be changed, you will need to just pick a very big limit. popping a value off a queue and consuming it will delete the value from the queue

venkata S.
venkata S.

venkata S.

Level
0
47 / 100
points

okay, to understand, the shared queue create a csv file, that file name used for parameter for next API, now what options I can choose to delete the row after use it.

it will delete automatically or how it works.

Do I need to consume the shared queue value from Javascript as "pollSharedValue(String)" ?

Neil W.
Neil W.

Neil W.

Level
4
5000 / 5000
points
Team

The queue is held in memory, you use the variable modifier action to place items on and take items off the queue. The csv is storage of the queue state between tests, I could run a test today to book hotel rooms and store resevation numbers. Run a second test tomorrow that loads in the csv at the start of the run to populate the queue, and look up the reservations and amend the bookings. the csv doesn't matter. You also don't need javascript.