0

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?

demouser123
  • 4,108
  • 9
  • 50
  • 82
Nadezhda T
  • 262
  • 8
  • 24

1 Answers1

1

"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

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thank you. I checked WDS.browser.manage().deleteAllCookies() - even with that line, incognito mode in Chrome after 1st user logout keeps information about this previous user (Application->Storage) or it could be seen in login form which appears with previous user name and option "use another account"... Chromedriver v90. Could it be driver version specific problem? – Nadezhda T May 26 '21 at 15:40
  • Variant3 with separate Thread groups for 2 client-side users works, however I have server-side Thread group, which should work in parallel with both client-side users... – Nadezhda T May 26 '21 at 15:54
  • 1
    If logout doesn't clear local storage it sounds like an application bug and should be reproducible for real user using the real browser. If you need a workaround - I believe `WDS.browser.getSessionStorage().clear()` and `WDS.browser.getLocalStorage().clear()` should help you – Dmitri T May 26 '21 at 17:36
  • thank you for assortiment of ideas and solutions and your time. Looks like last presupposition took place, even after adding clear commands some misbehave occured. – Nadezhda T May 28 '21 at 12:16