loadrunner 关联问题求助
本帖最后由 xianfeng1224 于 2011-11-16 22:32 编辑创建者=张三 | 创建者=李四 | 创建者= 王五
****************************************************************
bugID bug摘要 | bugID bug摘要 | bugID bug摘要
0098 fenqibaobiaowenti3 | 0098 fenqibaobiaowenti2 | 0098 fenqibaobiaowenti1
...... ...... ......
要求:登陆后,选择“创建者”,点击“查询”,该人(张三)创建的bug被查询出来,点击第一条的“bug摘要”,查看bug内容。
我已经把创建者做了参数化(Name),分别是张三、李四、王五,又把bugID和bug摘要分别作了关联,(因为在bug摘要的LB中用到了bugid)
问题:按照上面设置后,可以关联到【bugid】的三个值,但是关联不到【bug摘要】的内容
请问通常这种情况,大家是怎么去做关联的?请指教
代码如下:
录制的脚本:
Action()
{
lr_think_time(7);
web_submit_data("BugList.php",
"Action=http://10.2.31.174/bugfree/BugList.php",
"Method=POST",
"RecContentType=text/html",
"Referer=http://10.2.31.174/bugfree/SearchBug.php",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=QueryTitle", "Value=", ENDITEM,
"Name=QueryType", "Value=", ENDITEM,
"Name=SaveQueryDivIsFocus", "Value=", ENDITEM,
"Name=AutoComplete", "Value=on", ENDITEM,
"Name=AndOr0", "Value=And", ENDITEM,
"Name=Field0", "Value=ProjectName", ENDITEM,
"Name=Operator0", "Value==", ENDITEM,
"Name=Value0", "Value=", ENDITEM,
"Name=AndOrGroup", "Value=AND", ENDITEM,
"Name=AndOr1", "Value=And", ENDITEM,
"Name=Field1", "Value=OpenedBy", ENDITEM,
"Name=Operator1", "Value==", ENDITEM,
"Name=Value1", "Value=zhangsan", ENDITEM,
"Name=AndOr2", "Value=And", ENDITEM,
"Name=Field2", "Value=ModulePath", ENDITEM,
"Name=Operator2", "Value=LIKE", ENDITEM,
"Name=Value2", "Value=", ENDITEM,
"Name=AndOr3", "Value=And", ENDITEM,
"Name=Field3", "Value=AssignedTo", ENDITEM,
"Name=Operator3", "Value==", ENDITEM,
"Name=Value3", "Value=", ENDITEM,
"Name=AndOr4", "Value=And", ENDITEM,
"Name=Field4", "Value=BugID", ENDITEM,
"Name=Operator4", "Value==", ENDITEM,
"Name=Value4", "Value=", ENDITEM,
"Name=AndOr5", "Value=And", ENDITEM,
"Name=Field5", "Value=BugTitle", ENDITEM,
"Name=Operator5", "Value=LIKE", ENDITEM,
"Name=Value5", "Value=", ENDITEM,
"Name=PostQuery", "Value=鎻愪氦鏌ヨ\xAF\xA2", ENDITEM,
"Name=QueryType", "Value=Bug", ENDITEM,
LAST);
lr_think_time(12);
web_link("fenqibaobiaowenti3",
"Text=fenqibaobiaowenti3",
"Snapshot=t5.inf",
EXTRARES,
"Url=Image/control_bg.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
"Url=Image/top_nav_menu.gif", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
"Url=Image/input_button.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
LAST);
return 0;
}
关联后的脚本:
Action()
{
lr_think_time(7);
/*bugid的关联 */
web_reg_save_param("topbugid",
"LB=<a href=\"Bug.php?BugID=",
"RB=\" ",
"Ord=1",
"Search=NoResource",
LAST);
/*bug编号的关联 */
web_set_max_html_param_len("9999999");
web_reg_save_param("toptitle",
"LB=title=\"",
"RB=\"class=\"FullLink Title\" target=\"_blank\">",
"Ord=1",
"Search=NoResource",
LAST);
web_submit_data("BugList.php",
"Action=http://10.2.31.174/bugfree/BugList.php",
"Method=POST",
"RecContentType=text/html",
"Referer=http://10.2.31.174/bugfree/SearchBug.php",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=QueryTitle", "Value=", ENDITEM,
"Name=QueryType", "Value=", ENDITEM,
"Name=SaveQueryDivIsFocus", "Value=", ENDITEM,
"Name=AutoComplete", "Value=on", ENDITEM,
"Name=AndOr0", "Value=And", ENDITEM,
"Name=Field0", "Value=ProjectName", ENDITEM,
"Name=Operator0", "Value==", ENDITEM,
"Name=Value0", "Value=", ENDITEM,
"Name=AndOrGroup", "Value=AND", ENDITEM,
"Name=AndOr1", "Value=And", ENDITEM,
"Name=Field1", "Value=OpenedBy", ENDITEM,
"Name=Operator1", "Value==", ENDITEM,
"Name=Value1", "Value={Name}", ENDITEM,
"Name=AndOr2", "Value=And", ENDITEM,
"Name=Field2", "Value=ModulePath", ENDITEM,
"Name=Operator2", "Value=LIKE", ENDITEM,
"Name=Value2", "Value=", ENDITEM,
"Name=AndOr3", "Value=And", ENDITEM,
"Name=Field3", "Value=AssignedTo", ENDITEM,
"Name=Operator3", "Value==", ENDITEM,
"Name=Value3", "Value=", ENDITEM,
"Name=AndOr4", "Value=And", ENDITEM,
"Name=Field4", "Value=BugID", ENDITEM,
"Name=Operator4", "Value==", ENDITEM,
"Name=Value4", "Value=", ENDITEM,
"Name=AndOr5", "Value=And", ENDITEM,
"Name=Field5", "Value=BugTitle", ENDITEM,
"Name=Operator5", "Value=LIKE", ENDITEM,
"Name=Value5", "Value=", ENDITEM,
"Name=PostQuery", "Value=鎻愪氦鏌ヨ\xAF\xA2", ENDITEM,
"Name=QueryType", "Value=Bug", ENDITEM,
LAST);
lr_think_time(12);
web_link("{toptitle}",
"Text={toptitle}",
"Snapshot=t5.inf",
EXTRARES,
"Url=Image/control_bg.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
"Url=Image/top_nav_menu.gif", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
"Url=Image/input_button.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID=1093", ENDITEM,
LAST);
return 0;
}
服务器返回的界面脚本代码:
</tr>
<tr class="BugStatusClosed">
<td align="center">
<nobr>1093</nobr>
</td>
<td align="center">
<nobr>2</nobr>
</td>
<td align="center">
<nobr>2</nobr>
</td>
<td align="left">
<span class="Title">
<a href="Bug.php?BugID=1093" title="fenqibaobiao3" class="FullLink Title" target="_blank">
fenqibaobiao3
</a> </span>
</td>
<td align="left">
<a href="?QueryMode=OpenedBy|gaow">
张三
</a>
</td>
<td align="left">
<a href="?QueryMode=AssignedTo|Closed">
Closed
</a>
</td>
<td align="left">
<a href="?QueryMode=ResolvedBy|linql">
李明
</a>
</td>
<td align="left">
<a href="?QueryMode=Resolution|Fixed">
Fixed
</a>
</td>
<td align="left">
<a href="?QueryMode=LastEditedDate|2011-09-05">
2011-09-05
</a>
</td>
</tr>
请各路高手指点!万分谢谢! 关联的右边class前面有空格。
web_link中的bugid需要参数化取之。 学习学习 回复 1# xianfeng1224
成功关联后的结果:
web_set_max_html_param_len("9999999");
web_reg_save_param("toptitle",
"LB=\" title=\"",
"RB=\" class=\"FullLink Title\" target=\"_blank\">",
"Ord=1",
"Search=NoResource",
LAST);
一开始失败的原因:没有加Title前面的【” 】
还有一个问题,如果我想任意查看其中的一个bug,应该怎么写代码?已经写出了for循环,但是不知道该怎么一次读出数组中的值 这是解决上一个问题的代码 :
int i=1;
char a;
char b;
for(i=1;i<=atoi(lr_eval_string("{title_count}"));i++)
{
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
sprintf(b, "{title_%d}", i);
sprintf(a, "Text={title_%d}", i);
web_link(b,
a,
"Snapshot=t5.inf",
EXTRARES,
"Url=Image/control_bg.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID={bugid_i}", ENDITEM,
"Url=Image/top_nav_menu.gif", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID={bugid_i}", ENDITEM,
"Url=Image/input_button.png", "Referer=http://10.2.31.174/bugfree/Bug.php?BugID={bugid_i}", ENDITEM,
LAST); 还有很多其他的情况,大家讨论一下哦 要那么复杂干嘛你关联Bug.php?BugID=1093 这个后面的bugid不就行了,有啥难的?
页:
[1]