0
votes

So I have a test plan in Jmeter which reads an Auth token from CSV and does POST request.
But if it fails then I run a script that would update the CSV with a new Auth token.

The problem is that I do 4 different POST in one thread. So when 1 of them fails I run the script and want the other POST in the same thread to read the updated CSV.

But in Jmeter once it reads a CSV file it uses the the same values for the whole thread.
I see option for ALL Threads, Current Thread Group, and Current Thread.
But do not want to even share it in a current thread. I want to read the CSV for every POST in my current thread.


UPDATE from comments below.

My current test plan looks like the following:

HTTP POST --Read Auth Key From auth.csv
IF Controller (if last Sample Not Ok)
    -- Run the Script Update the auth.csv
HTTP POST --Read from auth.csv
IF Controller(if last Sample Not Ok)
    -- Run the Script Update the auth.csv

The problem is the 2nd POST request uses the old values from the CSV and not the new updated csv.

1
Can you provide what you have currently done, or any ideas you have as to how you would like this accomplished? - rud3y
My Current Test Plan Looks Like This 1)HTTP POST -Read Auth Key From auth.csv 2) IF Controller(if last Sample Not Ok) -- Run the Script Update the auth.csv 3) HTTP POST --Read from auth.csv 4)IF Controller(if last Sample Not Ok) -- Run the Script Update the auth.csv The problem is the second post uses the old values from the CSV and not the new updated csv - user2113551
basically I want to read the same csv file twice in the same thread. Right now ot only reads once for the first time and If I try again to read the same csv it uses the cached values. - user2113551
can you copy that file into another file and read that, then come back and try to read the first one you copied when it changes values? - rud3y
Can't you use CSV Data Set Config and re-read the auth from the csv-file into a variable before each HTTP POST? - ghdalum

1 Answers

0
votes

To do that you could use each HTTP POST and CSV Data Set Config "inside" a Transaction Controller.

Your Test Plan could be something like this:

Transaction Controller
    CSV Data Set Config
    HTTP POST 

IF Controller (if last Sample Not Ok)
    -- Run the Script Update the auth.csv

Transaction Controller
    CSV Data Set Config
    HTTP POST 

IF Controller (if last Sample Not Ok)
    -- Run the Script Update the auth.csv