个人网站: www.7dtest.com 7点测试群:(61369656)------(77273408)------(35710365)------(9410090)

如何在LR中做关联-Zee

上一篇 / 下一篇  2007-03-06 18:30:45 / 个人分类:Zee的生活

问题出现:

n   VuGen替代浏览器,脚本是hard-coded

n   HTTP是一种无状态的连接

n   同一用户两次登录的差异

n   单用户和多用户的差异(验证机制:session

 

关于session

 

n   记录用户的状态

n   验证用户的身份

n   在服务端创建并保存(永久的和临时的)

n   Session也保存在客户端,提交到服务器端验证(URL重写和cookies)

问题分析

n   用一种方法来满足服务器的验证。

n   保存来自服务器端的session,并传递给提交语句以保证验证通过。

 

 

需要关联的数据的特征

 

 

n   1,数据是从服务器传过来的。

 

n   2,数据是可变的。

 

VuGen与服务器的交互

关联的主要条件

n   1,简化或者优化代码。

n   2,动态数据。

n   3,提供唯一的数据。

如何鉴定什么样的错误需要关联

n   会出现什么错误讯息,与系统实做的错误处理机制有关。

n   错误讯息有可能会提醒您要重新登入,但是也有可能直接就显示HTTP 404的错误讯息。

n   LRLOG中也有些错误的提示:比如:27979等的错误(错误的原因是多种的,关联只是引起错误的一种原因)。

LR中需要用到的关联函数

n     web_create_html_paramSaves dynamic information on an HTML page to a parameter. (Obsolete: use only for LR 6.5 and below)

n     web_create_html_param_exSaves recurring dynamic information on an HTML page to a parameter. (Obsolete: use only for LR 6.5 and below)

n      web_reg_save_paramSaves non-NULL terminated dynamic data from an HTML page to a parameter.

n     web_save_param_lengthSaves the length of a parameter

n     web_save_timestamp_paramSaves the current timestamp.web_set_max_html_param_lenSets the maximum length of retrieved dynamic HTML information.

VuGen的关联方法

 

 

n   自动关联

 

n   手动关联

自动关联

n   record options--->correlation中启用enable correlation during recording recording.LR会用自已的关联规则来匹配需要关联的脚本

手动关联

n   步骤:

1,录制。

2,回放。

3,回放出错后开启LOG

4,出错后查看LOG。(定位到某一行)

5,再重新录制一下脚本,把两份脚本对比。

 

 

 

录制回放

n   回放出错如下:

Action.c(37): Error -27979: Requested form not found   [MsgId: MERR-27979]

Action.c(37): web_submit_form("com.mercurytours.servlet.IteneraryServlet") highest severity level was "ERROR", 0 body bytes, 0 header bytes       [MsgId: MMSG-26388]

 

开启LOG查找需要关联的数据

n   run-time settings-->Log,设置Extened log.

n   再次回放。

n   定位需要关联的数据。(单协议在recording log,多协议在Generation Log中查到数据)

 

写关联函数

n     char GlParam1_Text1;//定义变量

 

n     web_reg_save_param("GlParam1_Text1",

n              "LB= name=\"",

n              "RB=\"",

n              "Ord=all",

n              "RelFrameId=1",

n              "Search=Body",

n              "IgnoreRedirections=Yes",

n              LAST);

n     在下面的语句中来调用:GlParam1_Text1

 

 

 

 

关联函数的位置

n    It registers a request to find and save a text string within the server response. The operation is performed only after executing the next action function, such as web_url.from help).

n    定位到变量的那一行的上面。

 

Note:引用web_reg_save_param中的变量时,要用{}。

要打印出来,用lr_evel_string取值。

一些说明:

n    开启WinDiff时出现File no longer available的错误信息
WinDiff这个工具有些限制,脚本路径不能有空格。

n    ctrl+F8可以扫描脚本中需要关联的地方


TAG: Zee的生活

如果Zee还在工作 引用 删除 Zee   /   2007-04-16 18:19:02
是我写错了,谢谢指正。
Iris的空间 引用 删除 Iris_suz   /   2007-04-16 15:12:04
你这里说的是哪个版本的啊?不知道是版本问题还是写错了,
"自动关联
n    runtime setting-->internet protocol-->correlation中启用enable correlation during recording.LR会用自已的关联规则来匹配需要关联的脚本"应该是record options--->correlation中启用enable correlation during recording
测试者家园[Fish_yy的家园] 引用 删除 fish_yy   /   2007-03-08 14:53:42
5
 

评分:0

我来说两句

我的栏目

日历

« 2024-05-08  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 158944
  • 日志数: 146
  • 图片数: 1
  • 建立时间: 2006-12-05
  • 更新时间: 2012-11-16

RSS订阅

Open Toolbar