I am new to JMeter. I tried to record login or sign-up using the JMeter proxy in Magento 2.2.7 and I tried to view the result in the JMeter, but in JMeter. I'm unable to get the response of the login page success. Please find the screenshot:
-
Does this answer your question? How to login a page using JMeter?– PDHide ♦Dec 14, 2019 at 9:39
-
No.I already followed the steps and when seeing the view result JMeter, it will not showing the response page.Its again showing the login page in the response(please refer the screenshot above).– ArulDec 14, 2019 at 10:22
1 Answer
In the absolute majority of cases you will not be able to successfully replay script recorded by HTTP(S) Test Script Recorder without performing correlation
Modern web applications widely use dynamic parameters for client-side state tracking or security reasons, in case of Magento most probably your login fails due to form_key
parameter incorrect value.
Also don't forget about Cookies
The steps would be:
- Add HTTP Cookie Manager to your Test Plan
Add HTTP Request sampler to open login page, i.e. make a GET request to
/customer/account/login/
Add a suitable JMeter's Post-Processor to extract the aforementioned
form_key
field value, I would recommend going for CSS Selector ExtractorAdd another HTTP Request sampler which will perform the actual login, i.e. making a POST request to
/customer/account/loginPost
Make sure to replace recorded hard-coded value of theform_key
parameter with the reference to JMeter Variable from step 3That's it, you should be logged in now:
-
now I am trying for signup but it redirects to the login page. Is there are any changes I need to do for signup using JMeter?– ArulJan 6, 2020 at 13:04
-
1The overall process should be similar, just pay attention to the correlation of the dynamic parameters. I cannot provide comprehensive answer due to the limitation of the comment field, if you will be still experiencing problems - consider asking a new question– Dmitri TJan 6, 2020 at 13:10
-
I posted as a separate question sqa.stackexchange.com/questions/42049/….– ArulJan 6, 2020 at 15:12
-
-
sorry, from your previous comment only I shared a link. Your previous answers are very helpful, thank you.– ArulJan 6, 2020 at 16:12