2
votes

The issue is with JMeter parameterization Logic. I have a csv file with user id and pwd - which is fine Another CSV has 10 records, one for each user ID. How do I map these records to user ids?

Csv1: UserID, Pwd TestUser1, Password1 TestUser2, Password1

CSV2: Record Rec1forUser1 Rec2forUser1 Rec3forUser1 Rec1forUser2 Rec2forUser2

and so on..

How do I arrange the mapping when multiple users (say 2) are going to run for a Loop of 3 records each.

1
Welcome to StackOverflow! We have some best practices here what should be included in a good question. They ensure that your question is clear, that people can help you efficiently and that your question is of value to future readers. In your case, I recommend you invest a few minutes to create a minimal reproducible example. Then edit your question to include it. You will find that your questions can be answered much quicker then. In general, make sure you've read our guide How to ask.akraf

1 Answers

0
votes

It's not possible with standard JMeter equipment, what you're asking for.

I would suggest to use the User data set as a driver, and for the record read at each iteration then split second dataset to separate files (1 per user), then ingest 'em in the custom JSR223 element - actually, the file operations toolset Groovy equipped with makes that task pretty easy, smth. like:

new File(path + userID + "_someSuffix.csv").eachLine { line ->
    line.split(',').each { field ->
        ... use fields here somehow ...
    }
}

In case you have to have multiple iterations per user, you probably would have to read the Users dataset that way as well.

And finally, yet another way is to denormalize/flatten your dataset: include (repetitive) User records into second dataset along with data belonging to user, like:

TestUser1, Password1, Rec1forUser1 
TestUser1, Password1, Rec2forUser1
TestUser1, Password1, Rec3forUser1 

That may not look pretty, but would do the job.