0
votes

I have a .csv file in which I have 4 values. name,age,subject,gender. If i am giving single values for all then it is very easy using JMeter for e.g.:

John,23,Maths,Male

But if I have to give for many subjects like e.g.:

John,23,Maths:Science:History,Male

How could I achieve this using JMeter?

I have to pass this in XML request.

<name>John</name>
<age>23</age>
<subject>Maths:Science:History</subject>
<gender>Male</gender>
1

1 Answers

1
votes

Have you tried already to do this using CSV Data Set Config?

Maybe I'm missing something in your issue but since you haven't to operate each subject separately you can read all the subjects list into the single variable and then refer they via this variable.

I.e. if you have to read entry from list like

...
John,23,Maths:Science:History,Male 
...

you can setup CSV Data Set Config in following way:

Filename = YOUR_CSV_FILE
File Encoding = 
Variable Names = vName,vAge,vSubjects,vGender
Delimiter = ,        // this is to delimit entries in list, not variables

and then use extracted values via variables:

<name>${vName}</name>
<age>${vAge}</age>
<subject>${vSubjects}</subject>
<gender>${vGender}</gender>

(since subjects are separated via ":" and variables - via "," - full subjects list will be extracted as one value).


Little guides for CSV Data Set Config usage here and here.


UPDATE 2012-04-19:
Quick example to avoid unnecessary explanations and misunderstands.

enter image description here

  • While Controller condition is ${__javaScript("${vName}"!="<EOF>",)}.
  • All the ":"-separated subject for each entry are extracted and stored as single variable - that's not a problem for CSV Data Set Config.