05构建一个网站高级测试计划

05构建一个网站高级测试计划

Created Tuesday 23 May 2017

In this section, you will learn how to create advanced Test Plans to test a Web site.
本章,你将会学习如何创建一个高级测试计划去测试网站。
For an example of a basic Test Plan, see Building a Web Test Plan.
对于基本测试计划的例子,查看用户使用:测试计划:构建一个网站测试计划。

5.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.
如果你的网站使用URL重写而不是cookies来保存session信息,那么你为了测试你的网站需要做一些额外的工作。

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重写,JMeter需要解析来自服务器的HTML并取出唯一的session ID,JMeter使用对应的HTTP URL Re-writing Modifier来完成这些。只需要输入你的session ID参数名到你的修改器中,JMeter会找到它并将它添加到每个请求中。如果请求已经有一个值了,它会进行替换。如果”Cache Session Id?”被选中,那么最近发现的session id会被保存,如果以前的HTTP取样器不包含session id,那么它将会被使用。

URL Rewriting ExampleURL重写例子

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中展示了一个使用URL重写测试计划。注意这个URL重写修改器添加到了SimpleController中,因此保证它只会影响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中,我们看到URL重新修改器的GUI,GUI只有一个用于用来指定session ID参数名的字段。这里还有一个多选框,多选框标示session ID应该被路径分隔的(separated by a “;”),而不是一个请求参数。
这里写图片描述
Figure 2 - Request parameters

5.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.
HTTP Header Manager让你们定制JMeter发送HTTP请求头的信息。头中包含了像”User-Agent”,”Pragma”,”Referer”等属性。

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 objects in your test.
HTTP Header Manager,像HTTP Cookie Manager一样,应该添加到线程组级别,除非因为一些原因你希望在你的测试中为不同的HTTP请求对象指定不同的头。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值