Search code examples
jmeterjmeter-plugins

Random checkout with 2 types of user using jmeter


I am looking for random user type checkout for our ecommerce website with 2 types of users :

  1. Guest User
  2. Loggedin User [Already registered]

What my question is there will be diff. requests and POST parameters if I do checkout as guest and diff. parameters if I do checkout as loggedin user. So here how to handle it.

Random controller can be used but how can I tell jmeter that if random controller do checkout with guest then follow X number of requests in test plan otherwise follow Y number of requests for logged in user.


Solution

  • The easiest option would be using If Controller like:

    • If Guest
      • HTTP Request relevant for the Guest User
    • If Regiestered
      • HTTP Request relevant for Registered User

    You can distinguish whether user is registered or not via i.e. Regular Expression Extractor

    1. Add Regular Expression Extractor as a child of the previous request
    2. Configure it to look for something which identifies logged in user and store the value into a JMeter Variable called foo
    3. Use the following line in the If Controller condition area for the registered user

      "${foo}" != "null"
      
    4. Use the following line in the If Controller condition area for the guest user

      "${foo}" == "null"