Search code examples
jmeterperformance-testingbeanshell

How run specific csv file based on specific users using jmeter


I have test plan like this:

Thread group |---User parameter(user'scredentials mention there) |--Request body (same for the users) |----csv file1 |-----csv file2

Now if it is users.name==joe, this should execute csvfile1 if it is user.name==nmeon, execute csvfile2 through user parameter I got user name in the JMeter console.

How to write the script using IF controller/ bean shell If I use what would the script written for this?


Solution

  • You basically have 2 options:

    1. Change your file names to be nmeon.csv and joe.csv and use ${user.name} in the CSV Data Set Config "Filename" section

      JMeter CSV Data Set Variable

    2. Use 2 If Controllers like:

      • If Controller, condition: ${user.name} == "joe"
        • test logic specific for joe
      • If Controller, condition: ${user.name} == "nmeon"
        • test logic specific for nmeon
    3. Use Switch Controller (the approach is similar to If Controllers)