Reputation: 39
i have been searching, how can i pass two values in one parameter from a csv file, for example. i need to put the names john and mary in the parameter "name"
so the link should look like this --- http://samplelink.com?name=john&name=mary BUT some scenario have just one name,, so the link would be --- http://samplelink.com?name=john
Using jmeter for API test
Thanks !
Upvotes: 0
Views: 8327
Reputation: 168157
Given you have CSV file which looks like:
john,mary
joe
ann,jim
Add CSV Data Set Config to your Test Plan and configure it like:
Add JSR223 PreProcesssor as a child of your HTTP Request sampler and put the following code into "Script" area:
def name = vars.get('name')
name.split(',').each { currentName->
sampler.addArgument('name', currentName)
}
${name}
variable, split it by comma and add a request parameter for each found value. More information: A Quick Guide to JMeter PreProcessors
Upvotes: 2