问题
My goal is to perform Load testing in jmeter for number of users. The application being in test is using ‘Basic Authentication‘ method at the login page and its URL has few parameters that are related to the login user. So how can I perform load testing for e.g. 100 users where as url is customized for the login user??
回答1:
Your question is basically for doing authentication / login process via JMeter. Number of users are irrelevant in context of this question. Once you have a working Test Plan, you can use as many number of users as you want. But for that, you must first send valid authentication/login requests using JMeter.
This process could vary depending on security protocols / technologies used by your application. Since you have not shared that info. So I am sharing general steps to do this process.
Record your login scenario in JMeter via JMeter Recording Controller https://www.digitalocean.com/community/tutorials/how-to-use-jmeter-to-record-test-scenarios
Make sure that you have added following in your test plan
- Cookie Manager
- Header Manager
- Cache Manager
After recording your login scenario, identify the requests where the login parameters were sent. Also identify if any additional authentication checks were sent along with login parameters.
Now parameterize the parameters that you identified in previous step. You might need developers help here (if there are additional security checks in login process). For parameterization you can use CSV data in JMeter.
Use debug sampler and Tree view listener to verify the content of requests/responses. Ensure the successful login by checking response of login request. You can use Jmeter assertion for that.
It could be quite complicated process but there is lot of helpful content on this topic in form of blogs/ tutorial videos etc.
For start you can check the below links.. http://www.communardo.de/home/techblog/2010/12/27/liferay-performance-testing/ https://blazemeter.com/blog/how-use-http-basic-authentication-jmeter
回答2:
Don't pass username and password via URL string, it is not secure, use HTTP Authorization Manager instead.
You can use CSV Data Set Config in order to parametrize username/password pairs in the HTTP Authorization Manager.
来源:https://stackoverflow.com/questions/34251195/load-testing-using-jmeter-with-basic-authentication