Using JMeter, I want to test the page. After fill in and submit the form, some insert into database is performed (adding new trip).
Path: /ProjectName/admin/addTrip.html
Method: POST
Parameters:
basePrice 500.0
hotelId 2
description Some text
The main issue is that the page is available after log in. And I don't know how to log in with j_spring_security_check
using JMeter.
I tried to use Login Config Element as the parent of HTTP Request
to addTrip page. As the result in View Result Tree -> Response data
I get the login form. Of course this is not expected result.
Next I tried to use HTTP Request
to login page.
Path: /ProjectName/j_spring_security_check
Method: POST
Parameters:
j_password mypassword
j_login mylogin
The result seems to be fine. View Result Tree -> Response data
shows the correct (after login) page.
On the same level in thread group I added Http Request
of addTrip. The result is the same as in the previous case - login page. No after addTrip page and no insert to database.
Your plan must be missing:
And you probably didn't handle right the spring security login phase which includes redirect.
The best solution for you is to use JMeter Proxy Recording. If you're a beginner in JMeter read:
http://jmeter.apache.org/usermanual/build-web-test-plan.html
http://jmeter.apache.org/usermanual/best-practices.html
http://jmeter.apache.org/usermanual/hints_and_tips.html
Then for each component you will use you can read:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With