开发者

rails app load testing with jmeter

开发者 https://www.devze.com 2023-02-02 20:53 出处:网络
I am trying to load test a rails app with jmeter but have not gotten pass login. In application_controller I commented out protect_from_forgery so as not to have to use the authenticity_token.

I am trying to load test a rails app with jmeter but have not gotten pass login.

In application_controller I commented out protect_from_forgery so as not to have to use the authenticity_token.

It now looks like the app session id cookie from idex/home page response is not getting saved by jmeter's http cookie manager or the 开发者_如何学JAVAcookie is getting saved by the jmeter cookie manager and not getting passed in the request.

This is what my post from jmeter looks like from tomcat access log:

192.168.247.13 [07/Jan/2011:11:01:27 -0500] r:200 d:58 'POST /dash/account/login HTTP/1.1' 2088

This is what the post to login looks like from a browser (Chrome):

192.168.247.13 [07/Jan/2011:10:56:51 -0500] r:200 d:112 'POST /dash/account/login HTTP/1.1' 16

For some reason, the post from the browser works and it redirects to next page. The post from JMeter returns the view (login.erb) instead of a redirect. Another indication that either the cookie manager is not saving the session cookie or the session cookie is not being sent in the request by jmeter.

Any one ever run into this issue with jmeter and a rails app? Any suggestions?

Thanks in advanced.


Issue was not with cookie manager. Cookie manager was working just fine. Rather i needed to add a header manager and add the following header and value:

Header: X-Requested-With Value: XMLHttpRequest


You need to extract the authenticity_token from the login page and put it into your form post.

Instructions here: http://ertw.com/blog/2010/06/29/load-testing-a-rails-app-and-the-authenticity_token/


On your login page, do you have "Redirect" enable? You also need to have a JMeter request for every page you want to access.

So, you script would need to look like this:

  • Cookie Manager
  • Thread Group -- POST Login Page -- GET landing page -- other pages
0

精彩评论

暂无评论...
验证码 换一张
取 消