Question

I pass the username and password using csv data set config. Some of the users have the permission to edit the record. Some have only view permission. So, is it possible to check which user is logged in and execute the rest of the script accordingly.

Was it helpful?

Solution 2

Make your CSV file structure to look like:

username, password, canedit

so it'll be something like:

john, doe, true
foo, bar, false

Add CSV Data Set Config with the following configuration in Variable Names field:

username, password, canedit

After that you can put 2 IF Controllers with the following conditions:

  • ${canedit}==true
    • Request relevant for the editor
  • ${canedit}==false
    • Request relevant for read-only user

Hope this helps.

OTHER TIPS

Jmeter is load testing tool what you are asking for is more than for which purpose tool is designed. Simple Approach :

Record 2 scripts for different users and run them in a single test plan

Test plan

Threadgroup 1 (user which has write permissions)(no of users - workload model)

Threadgroup 2 (user which without write permissions)(no of users - workload model)

That is good approach,

If you want to use single script which might fail in some cases,

there are if controller,switch controller,module controller available. have a look at them and use them according to your requirement (switch controller is good for your case in my opinion)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top