0
votes

Sorry for my poor English, and thank you in advance.

I'm trying to make a thread group that makes jmeter logged in our system. to accomplish this, I need to POST data which contains ID, password, and token.

The token generated every time when the page has opened and hold in hidden value. So, the usual solution which is like GET response, do the regular expression extractor, and make the value variable and POST it later request doesn't work for me. since the token become different from when jmeter GET token and POST it.

Then, I found a parallel controller and this might be a solution for me. but I can't find a way to do it. also, there are no references in my mother language(Japanese). I want POST token to certain login action so I need to do regular expression extractor with parallel controller. then POST the token with ID and password at same time.

I want to know the way of the above or if it's impossible, is there any alternative solution that might work for me.

Thank you a lot for your help.

2
perhaps install selenium plugin and try to hold the cookie for the rest of the test?Hodaka matsuki
Hi, Just to make it clear, can you let me know if I have understood your scenario correctly? 1. We send a GET request we will get a response with token 2. We need to get token and send a POST with username, Id, Password. What is not clear to me is when is the token is going to get changed?Muditha Perera
Thanks for your answer! The token got generated every time we send request, and got response from the apprication, so the token will be change when 1 and 2.Hodaka matsuki

2 Answers

0
votes

Don't worry about language at all :) I will add a solution according to how I understand your problem.

As I understood, your scenario is,

  • We Request a page
  • We will get a response with token
  • We fetch the token and send the next request with the token
  • We will get a response with a different token
  • Need to fetch the new token and send another request

In this case, I think you are trying to use the first token in all the requests. Without doing that what if you fetch the token per each request?

The problem with the parallel controller is if you want to fetch the token from a previous request. It might not work.

Please correct me if I haven't understood the question correctly

0
votes

Parallel Controller is not something you should be using, it's for simulating AJAX requests as JMeter cannot execute JavaScript like browser does and hence cannot run multiple HTTP request samplers in parallel with one virtual user.

Your test plan structure should be much simpler, to wit:

  • HTTP Request sampler (to get login page)
    • a Post-Processor (most probably you're looking for CSS Selector Extractor) to get the values from hidden fields
  • HTTP Request sampler (to perform login)

See Variabilize and Correlate the script chapter for more details on the concept