51Testing软件测试论坛
标题:
如何参数化动态数据?
[打印本页]
作者:
morpheues_12
时间:
2005-9-7 17:45
标题:
如何参数化动态数据?
用户登陆系统,添加一个班级,然后在这个组里添加学生,这个班级有个ID,这个ID是刚生成的,那我应该怎么参数化这个ID呢?
作者:
kernzhang
时间:
2005-9-7 22:46
你首先要自己编写一个小程序去生成这个ID(如果这个ID是客户端生成的)如果是server端生成,你就是用关联将值获得
然后是用lr_save_string()将他转化为LR的内部变量,然后再将此变量付给函数!就搞定
作者:
Wins
时间:
2005-9-9 13:41
斑竹给个例子,如何操作?
作者:
morpheues_12
时间:
2005-9-9 15:41
Action()
{
web_set_max_html_param_len("1024");
web_url("192.168.2.2:8000",
"URL=http://192.168.2.2:8000/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/images/login_3_3.gif", ENDITEM,
LAST);
lr_think_time( 3 );
web_submit_form("loginAction.any",
"Snapshot=t2.inf",
ITEMDATA,
"Name=userName", "Value={帐号}", ENDITEM,
"Name=password", "Value={密码}", ENDITEM,
"Name=Submit", "Value=登录", ENDITEM,
EXTRARES,
"Url=/privateuser/images/zgdx_bg.gif", "Referer=http://192.168.2.2:8000/privateuser/head.htm", ENDITEM,
"Url=/privateuser/images/998_10.gif", "Referer=http://192.168.2.2:8000/privateuser/mainmid.htm", ENDITEM,
"Url=/privateuser/images/menu_bg_001.gif", "Referer=http://192.168.2.2:8000/privateuser/leftmenu.jsp", ENDITEM,
LAST);
web_url("privateContactGroupAction.any",
"URL=http://192.168.2.2:8000/privateuser/privatecontact/privateContactGroupAction.any?jump=privateGroupTree",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/leftmenu.jsp",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
/* Registering parameter(s) from source task id 0
// {groupId2} = "0"
// */
web_reg_save_param("groupId2",
"LB/IC=<input type=\"hidden\" name=\"groupId\" value=\"",
"RB/IC=\">",
"Ord=1",
"Search=body",
LAST);
web_url("userbusinessinfoAction.any",
"URL=http://192.168.2.2:8000/privateuser/privatecontact/userbusinessinfoAction.any?jump=privateUserUpdateInput&groupId=0",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/mainbody.htm",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
web_submit_data("privateContactGroupAction.any_2",
"Action=http://192.168.2.2:8000/privateuser/privatecontact/privateContactGroupAction.any",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/privatecontact/userbusinessinfoAction.any?jump=privateUserUpdateInput&groupId=0",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=jump", "Value=privateGroupAddInput", ENDITEM,
"Name=groupId", "Value={groupId2}", ENDITEM,
LAST);
lr_think_time( 4 );
web_submit_form("privateContactGroupAction.any_3",
"Snapshot=t6.inf",
ITEMDATA,
"Name=name", "Value=测试1", ENDITEM,
LAST);
web_url("privateContactGroupAction.any_4",
"URL=http://192.168.2.2:8000/privateuser/privatecontact/privateContactGroupAction.any?jump=privateGroupTree",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/leftmenu.jsp",
"Snapshot=t7.inf",
"Mode=HTML",
LAST);
/* Registering parameter(s) from source task id 0
// {groupId3} = "619"
// */
web_reg_save_param("groupId3",
"LB/IC=<input type=\"hidden\" name=\"groupId\" value=\"",
"RB/IC=\"/>",
"Ord=1",
"Search=body",
LAST);
lr_save_string("groupId3","{组名}");
web_url("privateContactAction.any",
"URL=http://192.168.2.2:8000/privateuser/privatecontact/privateContactAction.any?jump=privateContactAddInput&groupId={组名}&page=1&contactInfoType=31",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/privatecontact/privateContactGroupAction.any?jump=privateGroupAdd",
"Snapshot=t8.inf",
"Mode=HTML",
LAST);
lr_think_time( 9 );
web_submit_data("privateContactAction.any_2",
"Action=http://192.168.2.2:8000/privateuser/privatecontact/privateContactAction.any",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.2.2:8000/privateuser/privatecontact/privateContactAction.any?jump=privateContactAddInput&groupId={组名}&page=1&contactInfoType=31",
"Snapshot=t9.inf",
"Mode=HTML",
ITEMDATA,
"Name=jump", "Value=privateContactAdd", ENDITEM,
"Name=groupId", "Value={组名}", ENDITEM,
"Name=page", "Value=1", ENDITEM,
"Name=contactInfoType", "Value=31", ENDITEM,
"Name=code", "Value=1213", ENDITEM,
"Name=name", "Value=1313", ENDITEM,
"Name=alias", "Value=", ENDITEM,
"Name=position", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=postCode", "Value=333333", ENDITEM,
"Name=webPage", "Value=", ENDITEM,
"Name=companyName", "Value=ddd ", ENDITEM,
"Name=phone", "Value=", ENDITEM,
"Name=province", "Value=重庆", ENDITEM,
"Name=city", "Value=重庆", ENDITEM,
"Name=address", "Value=", ENDITEM,
"Name=fax", "Value=", ENDITEM,
"Name=mobile", "Value=", ENDITEM,
"Name=pas", "Value=057112345678", ENDITEM,
"Name=qq", "Value=", ENDITEM,
"Name=msn", "Value=", ENDITEM,
"Name=rever", "Value=1", ENDITEM,
LAST);
return 0;
[
Last edited by morpheues_12 on 2005-9-9 at 16:10
]
作者:
morpheues_12
时间:
2005-9-9 15:42
版主帮我看看,为什么我已经把组的字符串保存到参数中了,那添加人的时候还是添加到以前的那个组里?
作者:
xxyyzzz
时间:
2005-9-12 09:58
问个问题,看过的书参数化时左边界都写成LB="......",看到有的程序中就写成LB/IC=,那么LB/IC=代表的是什么意思呢,什么情况要这样用?谁能给解释一下吗,多谢
作者:
xxyyzzz
时间:
2005-9-12 09:58
问个问题,看过的书参数化时左边界都写成LB="......",看到有的程序中就写成LB/IC=,那么LB/IC=代表的是什么意思呢,什么情况要这样用?谁能给解释一下吗,多谢
作者:
xxyyzzz
时间:
2005-9-12 09:58
问个问题,看过的书参数化时左边界都写成LB="......",看到有的程序中就写成LB/IC=,那么LB/IC=代表的是什么意思呢,什么情况要这样用?谁能给解释一下吗,多谢
作者:
nettie
时间:
2005-9-12 10:37
/IC是忽略大小写
作者:
xxyyzzz
时间:
2005-9-12 10:56
呵呵,原来是这样啊,谢谢楼上的
作者:
morpheues_12
时间:
2005-9-12 17:02
终于搞好了,关联弄错了。
作者:
tina_zhang
时间:
2007-6-8 10:56
如果只是应用于楼主的例子中,lr_save_string函数是不是有点多余呀?直接用”groupId3“代替”组名“不就可以了吗?不知道我的理解有没有偏差
作者:
mli@dtri.com
时间:
2007-8-11 10:01
原帖由
nettie
于 2005-9-12 10:37 发表
/IC是忽略大小写
谢谢,一直想知道
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2