JMeter-Building an Advanced Web Test Plan
2015-06-09 10:49
561 查看
1. Handling User Sessions With URL Rewriting
If your web application uses URL rewriting rather than cookies to save session information, then you'll need to do a bit of extra work to test your site.
To respond correctly to URL rewriting, JMeter needs to parse the HTML received from the server and retrieve the unique session ID. Use the appropriate HTTP URL Re-writing Modifier to accomplish this. Simply enter the name of your session ID parameter into the modifier, and it will find it and add it to each request. If the request already has a value, it will be replaced. If 'Cache Session id?' is checked, then the last found session id will be saved, and will be used if the previous HTTP sample does not contain a session id.
URL Rewriting Example
Download this example. In Figure 1 is shown a test plan using URL rewriting. Note that the URL Re-writing modifier is added to the SimpleController, thus assuring that it will only affect requests under that SimpleController.
Figure 1 - Test Tree
In Figure 2, we see the URL Re-writing modifier GUI, which just has a field for the user to specify the name of the session ID parameter. There is also a checkbox for indicating that the session ID should be part of the path (separated by a ";"), rather than a request parameter
Figure 2 - Request parameters
2. Using a Header Manager
The HTTP Header Manager lets you customize what information JMeter sends in the HTTP request header. This header includes properties like "User-Agent","Pragma","Referer", etc.
The HTTP Header Manager, like the HTTP Cookie Manager, should probably be added at the Thread Group level, unless for some reason you wish to specify different headers for the different HTTP Request objectes in your test.
If your web application uses URL rewriting rather than cookies to save session information, then you'll need to do a bit of extra work to test your site.
To respond correctly to URL rewriting, JMeter needs to parse the HTML received from the server and retrieve the unique session ID. Use the appropriate HTTP URL Re-writing Modifier to accomplish this. Simply enter the name of your session ID parameter into the modifier, and it will find it and add it to each request. If the request already has a value, it will be replaced. If 'Cache Session id?' is checked, then the last found session id will be saved, and will be used if the previous HTTP sample does not contain a session id.
URL Rewriting Example
Download this example. In Figure 1 is shown a test plan using URL rewriting. Note that the URL Re-writing modifier is added to the SimpleController, thus assuring that it will only affect requests under that SimpleController.
Figure 1 - Test Tree
In Figure 2, we see the URL Re-writing modifier GUI, which just has a field for the user to specify the name of the session ID parameter. There is also a checkbox for indicating that the session ID should be part of the path (separated by a ";"), rather than a request parameter
Figure 2 - Request parameters
2. Using a Header Manager
The HTTP Header Manager lets you customize what information JMeter sends in the HTTP request header. This header includes properties like "User-Agent","Pragma","Referer", etc.
The HTTP Header Manager, like the HTTP Cookie Manager, should probably be added at the Thread Group level, unless for some reason you wish to specify different headers for the different HTTP Request objectes in your test.
相关文章推荐
- 从客户端(&)中检测到有潜在危险的 Request.Path 值解决方案
- UCGUI自定义字库及显示汉字的程序
- Jmeter- Building a Web test plan(3)
- int、NSInteger、NSUInteger、NSNumber的区别和联系
- Ueeshop:外贸网站报价,从免费到数十万是怎么回事?
- 第六章:如何对druid.io做成平台化
- UIWindow & UIWindowLevel
- StringBuilder与StringBuffer的区别(转)
- 解决Incorrect string value错误
- iOS蓝牙--CoreBluetooth基本使用
- a questions
- UIImage 切图
- jsp中 response和request区别
- 【Java GUI】文本框和文本区
- Android Studio --> Gradle Build设置自动
- Adeneo Embedded: Building Qt 5.1 for Freescale i.MX6Introduction on LTIB
- Building QT5 for IMX6(all)
- hdu 4027 Can you answer these queries?(线段树)
- UILabel调整字间距
- UITextView的创建/背景图片/边框和颜色/圆角等