JMeter_User
JMeter_User

Reputation: 303

How to do this scenario in Jmeter

I have a script where requestor login and sends invite. In the the same script,approver login and accept the invite. Issue: When I run the end to end script, approver login is failing because it takes requestor login by default (since cookies are not being cleared as all the samplers are under 1 thread group). how can I achieve this?

Note: I cannot make two scripts for invite and accept as they both should be one script; Note: All are APIs (including login)

Upvotes: 0

Views: 26

Answers (1)

Dmitri T
Dmitri T

Reputation: 168157

There are several options:

  1. Normally you should use different Thread Groups to represent different groups of business users, if you want to ensure that the request was made before the approver approves it you can use Inter-Thread Communication Plugin (most probably you will need it in any case as you should be passing the ID or name of item to approve somehow)

  2. If you cannot go for 2 thread groups the remaining options are:

    • Use If Controller and the __threadnum() function so "odd" users will be requestors and "even" approvers

    • Your application should have some form of logout link so make sure to kick off the relevant request before simulating logon of the next user. If it doesn't remove the cookies you can "help" JMeter a little bit and add JSR223 PostProcessor as the child of this "logout" request with the following code:

      sampler.getCookieManager().clear()
      

Upvotes: 1

Related Questions