Need to use multiple csv files for one scenario

HI ALL,

I have seen the below method in one of the posts, I tried with that but I’m getting an error as “Caused by: java.lang.IllegalArgumentException: requirement failed: Scenario names must be unique but found duplicates”.

def scn(feederName: String) = scenario(“foo”)…feed(csv(feederName))…

setUp(
scn(“file1.csv”).inject(atOnceUsers(2)),
scn(“file2.csv”).inject(atOnceUsers(2)),

scn(“file3.csv”).inject(atOnceUsers(2)),

scn(“file4.csv”).inject(atOnceUsers(2))

).protocols(httpProtocol)

Can anyone Help with this issue.

Thanks,
Bala C

Hi Bala Krishnan,

scn is a variable name basically. Try giving different names for each of scn like scn1,scn2 and so on.

Regards,
Manjunath

Hi Manjunath,

Thanks for the Reply. But here scn is a function name where I need to call that function(scn) with multiple CSV files.

If you have any idea kindly help with this issue.

Thanks,
Bala Krishnan C

Give different names for those functions.

Hi Manjunath,

Again Thanks for your comment. But I need the scenario like below one :

image.png

Where scn is a function which is called multiple times with different CSV file. My requirement is like the above one. Can you help me if you had any idea?

Thanks,
Bala C

The scenarios created by the scn function all have the same name - “foo”.

You need to pass on the scenario name along with the feeder name

Hi Bala,

Tried with below code. It Worked for me. Scenario Name should be unique.

def scn(fileName: String)= scenario(fileName).feed(csv(fileName))

setUp(scn(“file.csv”).inject(atOnceUsers(1)),

scn(“file2.csv”).inject(atOnceUsers(1))

).protocols(baseUrl).

Regards,

Sonali