Home > Enterprise >  Registering user with JMeter Keycloak Authorization flow
Registering user with JMeter Keycloak Authorization flow

Time:09-28

I am trying to create requests with JMeter that will create user through the application. I already designed the requests but have some problems.

The hierarchy is as follow:

  1. GET request to access the application and to extract: session code, execution, tab_id GET request
  2. GET request to access the Sign Up page GET request
  3. POST request for creating the user POST request

When I run the tests the user is not created. All the requests are passed, but the user is not created and when i check the results, some of the requests are with multiple values in the URL. For example here in the POST request I have multiple 'execution', 'client_id', 'tab_id' enter image description here

The Regular Expressions Extractors are as follow:

  1. session_code / session_code=(.*?)" / $1$ / 1
  2. execution / execution=(.*?)" / $1$ / 1
  3. tab_id / tab_id=(.*?)" / $1$ / 1

Anyone had any idea what need to be refactored in order to create an actual user ?

CodePudding user response:

I think you need to need to amend regular expressions like session_code="(.*?)"

"Duplicate" values are caused by JMeter Variables placeholders, i.e. if your regular expression doesn't have a match it has default value of ${session_code} which is not being substituted by the respective value.

You can observe JMeter Variables with their values using Debug Sampler

If you have problems coming up with a proper regular expression you can consider using Boundary Extractor instead, it's much easier to use (given you have "left" and "right" boundaries) and works much faster

Something similar has been asked and answered already

CodePudding user response:

The solution I made is as follow:

  1. Changed all the regular expressions to: ([^&"]*)
  2. Add one more 'Regular Expression Extractor' below the second GET request 'Open Sign Up Page'

Because after we access the Sign Up Page a new 'execution' id is generated and this 'execution' id needs to be provided to the POST request in order to successfully create the user.

  • Related