Is it possible to use 2 WDS for 2 different users roles in 1 JMeter Thread group?

127 views Asked by At

There are 2 users roles in Application.

When running 2 users roles sequentially in 1 browser (login1 - actions1 - logout1, login2 - actions2 - logout2), the set of problems with users identity /pages visibility and fails occurs.

Is it possible to use 1 dedicated browser window for each user role in 1 JMeter Thread group?

Or what could be solution to split 2 users for 2 separate browsers and manage them as 1 group acting sequentially, role1 actions first and then role2 actions?

1

There are 1 answers

4
Dmitri T On BEST ANSWER

"the set of problems with users identity /pages visibility and fails occurs" - it should not be the case given well-behaved script, just in case try executing the following line after the "logout"

WDS.browser.manage().deleteAllCookies()

More information: WebDriver.Options.deleteAllCookies()

Another option is to put conditions into your script like:

if (WDS.ctx.getThreadNum() == 0) {
    // code specific for user 1
}


if (WDS.ctx.getThreadNum() == 1) {
    // code specific for user 2
}

Where WDS.ctx stands for JMeterContext

And last but not the least, you can just put your users into different Thread Groups, just tick Run Thread Groups consecutively box on Test Plan level:

enter image description here

More information: The WebDriver Sampler: Your Top 10 Questions Answered