LoadRunner HTTP协议中几个有用的选项

录制选项:
在Recording Options窗口中的HTTP Properties-Advanced标签页,Recoding schemes中,有几个高级录制选项:
Headers:自动录制http头,默认是不录制headers。比如在另一篇文章Web测试中容易被忽略的Charset问题中提到的Http ContentType中的Charset问题,就可以通过在这里设置自动完成。录制后会在脚本中自动添加web_add_auto_header的语句。
Contect Types:通过一些过滤,设置录制脚本中包含的内容,默认是不做任何过滤。应用意义:在我的测试系统中,当客户端首次登录时会下载一些资源文件如js、gif等并保存在缓存中,在一定时间内客户端再次访问时不会再下载这些资源,因此,录制测试脚本时可以通过这个设置来屏蔽对某种类型的资源的录制。
Non-Resources:把某些类型的url设置为“非资源”,该设置在脚本中的体现是web_url中的Resource属性是0或1。具体应用意义下面说明。

Runtime选项:
在ContentCheck中定制检查规则,回放是LR可以自动匹配该规则,当满足条件时设置测试通过或失败。
比如我们测试一个web应用,当服务器返回Http 404、302等结果时,LR能够根据这些http status判断请求成功或失败。但如果http返回的状态是正常的,但我们的业务逻辑出错,系统返回的错误LR是无法识别的,那么可以通过在这里设置检验规则,当满足规则时认为时成功或失败。

Resource:指示URL是否属于资源。1 是;0 不是。设置了这个参数后,RecContentType参数被忽略。“Resource=1”,意味着当前操作与所在脚本的成功与否关系不大。在下载资源时如果发生错误,可以当作警告而不是错误来处理的(RTS中的Non-critical resource errors as warnings);URL是否被下载受“Run-Time Setting—Browser Emulation--Download non-HTML resources” 这个选项的影响。此操作的响应信息是不做为HTML来解析的。“Resource=0”,表明此URL是重要的,不受发送请求(RTS)的影响,在需要时也会解析它。

下面是帮助中的一些说明。
Specifying Non-Resource Content Types
When you record a script, VuGen indicates whether or not it will retrieve the resource during replay using the Resource attribute in the web_url function. If the Resource attribute is set to 0, the resource is retrieved during script execution. If the Resource attribute is set to 1, the Vuser skips the resource type.

Non-critical item errors as warnings.
This option returns a warning status for a function which failed on an item that is not critical for load testing, such as an image or Java applet that failed to download. This option is enabled by default. If you want a certain warning to be considered an error and fail your test, you can disable this option. You can set a content-type to be critical by adding it to the list of Non-Resources. For more information, see Specifying Non-Resource Content Types.

Download non-HTML resources
Instructs Vusers to load graphic images when accessing a Web page during replay. This includes both graphic images that were recorded with the page, and those which were not explicitly recorded along with the page. When real users access a Web page, they wait for the images to load. Therefore, enable this option if you are trying to test the entire system, including end-user time (enabled by default). To increase performance and not emulate real users, disable this option.

你可能感兴趣的:(loadrunner)