400 response while registering a new user in website in JMeter test script recording



  • testing website is taking OTP for registering a new user while recording the test script it registers and creates the new user but while running the same test in JMeter, it gives response code:400, and the user already exists. I have record 4 test script on the website with different fields every time but the /register shows error every time. but on the server, there is no error. SO something is missing in a JMeter/register response test. Please guide. I have added the header manager before this post request with application/JSON as a content-type but does not resolve the issue. My test plan:/register



  • Most probably your system simply doesn't allow multiple registrations using the same credentials set, looking into your request body "suspicious" parameters are:

    • email
    • phone
    • licenseId

    Well-behaved load test should represent real life application usage as close as possible, it means that each JMeter thread (virtual user) must represent a real user. Two different real users cannot have same emails and phones so you need to parameterize at least these 2 options.

    You can generate a random email address using __RandomString() function like:

    ${__RandomString(10,abcdefjhijklmnopqrstuvwxyz,)}@${__RandomString(5,abcdefjhijklmnopqrstuvwxyz,)}.${__RandomString(3,abcdefjhijklmnopqrstuvwxyz,)}
    

    and similarly the phone number using __Random() function like:

    ${__Random(111111111,999999999,)}
    

    Demo:

    enter image description here

    Check out Apache JMeter Functions - An Introduction article to get familiarized with JMeter Functions concept



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2