0

I have extracted the jwt token from the User login controller through my http service my test plan looks like thisresult tree [![Test plan][]]2 as seen in the images in login request it takes the header of Breakdown Configuration and it doesn't take authorization token value pass as a JSON object in Bearer ${token} although I have extracted it in JSON extractor and debug sampler shows it. I have also used the once only controller but it doesn't solve the issue. Please help in the nested Header Manager and how to use it correctly. Even I have used Bean Shell processor under my GETALL Bd-config request and pass the command :import org.apache.jmeter.protocol.http.control.Header;

sampler.getHeaderManager().add(new Header("Authorization","Bearer " + vars.get("BEARER"))); But it doesnt solve the issue. Please guide

  • import org.apache.jmeter.protocol.http.control.Header; sampler.getHeaderManager().add(new Header("Authorization","Bearer " + vars.get("token"))); – coder_m Nov 28 '19 at 15:44
0

If you want to keep this Extract token Post-Processor at the same level as other Samplers - you will need to remove the Debug Sampler and use i.e. Debug Post-Processor instead as given your current Test Plan:

  1. Extract token Post-Processor is being applied to Login sampler and (hopefully) gets the token
  2. Extract token Post-Processor is being applied to Debug Sampler, at this time your ${token} variable gets overwritten with the blank or default value. One more error is that you're defining the variable holding the token as token and referring BEARER which doesn't have any value
  3. Your GetAll Bd-config` sampler uses default or blank value

Check out JMeter Scoping Rules - The Ultimate Guide article for more information regarding JMeter test elements scope and properly placing them to achieve your goals.

Suggested test plan configuration would be something like:

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.