J. Doe
J. Doe

Reputation: 187

JMeter read / write to CSV Data Set Config

So I am loading data from CSV Data Set Config, what I like to do is write a value of a variable back into the next column of that same file in the same row but on the next column.

enter image description here

I check "url" for some specific response json, extract and create a variable "status" and "action" and add it to the row

enter image description here

Is it even possible to write back to the source csv file? Maybe some post processor script? Searching here is like a needle in a haystack sometimes.

Upvotes: 0

Views: 707

Answers (1)

Dmitri T
Dmitri T

Reputation: 168072

It is possible but I wouldn't recommend it as if you implement this post-processor logic and run your test with > 1 user most probably you will get into a race condition when several threads are concurrently writing into the same file.

Alternatives are:

  1. Adding your status and action variables values to JMeter's .jtl result file, just declare the following Sample Variables:

    sample_variables=url,status,action
    

    in the user.properties file and next time you run JMeter in command-line non-GUI mode you will see 3 extra columns in the .jtl results file holding the values of these 3 JMeter Variables

  2. If you want a separate file - first of all execute step 1 and then add a Flexible File Writer to your Test Plan and configure it to write the variables into a file, the relevant configuration would be something like:

    variable#0|,|variable#1|,|variable#2|\r\n
    

Upvotes: 2

Related Questions