51Testing软件测试论坛
标题:
为什么我的脚本运行成功,但老是出现登录界面呢?
[打印本页]
作者:
cxz1188
时间:
2006-2-20 16:19
标题:
为什么我的脚本运行成功,但老是出现登录界面呢?
各位大狭,请帮忙解答一下,如标题,情况是这样的,我录制了一个B/S结构的脚本,用户名与密码都参数化了(该系统一个用户在同一时间只允许一个登录),执行脚本是成功能,但发现界面出现的全是登录页面,为什么呢?如下是我录制的脚本,请各位帮忙看看,小女子在此脆谢了,我的MSN:cxz1188@163.COM
Action()
{
web_url("login.do",
"URL=http://localhost:8081/charging/login.do",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_rendezvous("登录");
lr_start_transaction("登录");
lr_think_time(40);
web_submit_form("login.do;jsessionid=B5B3505B0391E230C99AFDE30559E08A",
"Snapshot=t2.inf",
ITEMDATA,
"Name=busiBean.code", "Value={name}", ENDITEM,
"Name=busiBean.password", "Value={password}", ENDITEM,
LAST);
lr_end_transaction("登录",LR_AUTO);
lr_start_transaction("登录");
web_submit_form("login.do_2",
"Snapshot=t3.inf",
ITEMDATA,
"Name=busiBean.code", "Value=004", ENDITEM,
"Name=busiBean.password", "Value=", ENDITEM,
EXTRARES,
"Url=image/join.gif", "Referer=http://localhost:8081/charging/charging/tree.jsp", ENDITEM,
"Url=image/page.gif", "Referer=http://localhost:8081/charging/charging/tree.jsp", ENDITEM,
"Url=image/joinbottom.gif", "Referer=http://localhost:8081/charging/charging/tree.jsp", ENDITEM,
"Url=image/folder.gif", "Referer=http://localhost:8081/charging/charging/tree.jsp", ENDITEM,
LAST);
lr_end_transaction("登录",LR_AUTO);
lr_rendezvous("车辆收费");
lr_start_transaction("车辆收费");
web_add_cookie("csd=11; DOMAIN=localhost");
lr_think_time(21);
web_url("chargingReg.do",
"URL=http://localhost:8081/charging/charging/common/chargingReg.do",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:8081/charging/charging/tree.jsp",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"Url=/charging/image/submit.gif", ENDITEM,
LAST);
lr_end_transaction("车辆收费",LR_AUTO);
lr_start_transaction("车牌");
lr_think_time(38);
web_submit_data("searchVeh.do",
"Action=http://localhost:8081/charging/charging/vehicleNormal/searchVeh.do",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:8081/charging/charging/common/chargingReg.do",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=paraBean.operType", "Value=S", ENDITEM,
"Name=paraBean.searchVeh_flag", "Value=", ENDITEM,
"Name=busiBean.payor", "Value=", ENDITEM,
"Name=busiBean.vehNo", "Value=", ENDITEM,
"Name=busiBean.vehType", "Value=", ENDITEM,
"Name=busiBean.vehDeadline", "Value=0", ENDITEM,
"Name=busiBean.vehTonlevel", "Value=0.0", ENDITEM,
"Name=busiBean.lastDeadline", "Value=", ENDITEM,
"Name=busiBean.wayNum", "Value=0", ENDITEM,
"Name=busiBean.billNo", "Value=02263352", ENDITEM,
"Name=busiBean.payType", "Value=正常收费", ENDITEM,
"Name=busiBean.deadline_year", "Value=2005", ENDITEM,
"Name=busiBean.deadline_month", "Value=01", ENDITEM,
"Name=paraBean.refVehNo", "Value=B黑M00982", ENDITEM,
LAST);
lr_end_transaction("车牌",LR_AUTO);
lr_start_transaction("车牌1");
lr_think_time(25);
web_submit_data("searchVeh.do_2",
"Action=http://localhost:8081/charging/charging/vehicleNormal/searchVeh.do",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:8081/charging/charging/vehicleNormal/searchVeh.do",
"Snapshot=t6.inf",
"Mode=HTML",
ITEMDATA,
"Name=paraBean.operType", "Value=S", ENDITEM,
"Name=paraBean.searchVeh_flag", "Value=", ENDITEM,
"Name=busiBean.payor", "Value=绥化地区线务局", ENDITEM,
"Name=busiBean.vehNo", "Value=B黑M00982", ENDITEM,
"Name=busiBean.vehType", "Value=客货", ENDITEM,
"Name=busiBean.vehDeadline", "Value=0", ENDITEM,
"Name=busiBean.vehTonlevel", "Value=1.5", ENDITEM,
"Name=busiBean.lastDeadline", "Value=2005-01-31", ENDITEM,
"Name=busiBean.wayNum", "Value=1", ENDITEM,
"Name=busiBean.billNo", "Value=02263352", ENDITEM,
"Name=busiBean.payType", "Value=正常收费", ENDITEM,
"Name=busiBean.deadline_year", "Value=2005", ENDITEM,
"Name=busiBean.deadline_month", "Value=01", ENDITEM,
"Name=paraBean.refVehNo", "Value=B黑M01110", ENDITEM,
LAST);
lr_end_transaction("车牌1",LR_AUTO);
lr_rendezvous("保存");
lr_start_transaction("保存");
lr_think_time(15);
web_submit_data("saveVehFee.do",
"Action=http://localhost:8081/charging/charging/vehicleNormal/saveVehFee.do",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:8081/charging/charging/vehicleNormal/searchVeh.do",
"Snapshot=t7.inf",
"Mode=HTML",
ITEMDATA,
"Name=paraBean.operType", "Value=I", ENDITEM,
"Name=paraBean.searchVeh_flag", "Value=", ENDITEM,
"Name=busiBean.payor", "Value=黑龙江泰华医药有限公司", ENDITEM,
"Name=busiBean.vehNo", "Value=B黑M01110", ENDITEM,
"Name=busiBean.vehType", "Value=江西五十铃", ENDITEM,
"Name=busiBean.vehDeadline", "Value=0", ENDITEM,
"Name=busiBean.vehTonlevel", "Value=1.5", ENDITEM,
"Name=busiBean.lastDeadline", "Value=2004-06-30", ENDITEM,
"Name=busiBean.wayNum", "Value=1", ENDITEM,
"Name=busiBean.billNo", "Value=02263352", ENDITEM,
"Name=busiBean.payType", "Value=正常收费", ENDITEM,
"Name=busiBean.deadline_year", "Value=2005", ENDITEM,
"Name=busiBean.deadline_month", "Value=01", ENDITEM,
"Name=paraBean.refVehNo", "Value=B黑M01110", ENDITEM,
LAST);
lr_end_transaction("保存",LR_AUTO);
return 0;
}
作者:
cxz1188
时间:
2006-2-20 21:47
标题:
没人知道吗?
自己先顶一下,不要沉呀,我可等着救命呀
作者:
cxz1188
时间:
2006-2-20 21:47
标题:
没人知道吗?
自己先顶一下,不要沉呀,我可等着救命呀
作者:
金毅
时间:
2006-2-21 09:13
应该是sessionid的原因,我估计,可能需要关联
作者:
fish_yy
时间:
2006-2-21 10:22
“各位大狭,请帮忙解答一下,如标题,情况是这样的,我录制了一个B/S结构的脚本,用户名与密码都参数化了(该系统一个用户在同一时间只允许一个登录),执行脚本是成功能,但发现界面出现的全是登录页面,为什么呢?如下是我录制的脚本,请各位帮忙看看,小女子在此脆谢了,我的MSN:cxz1188@163.COM”
我觉得你应该检查一下,你是不是取的是同一个用户啊:),你可以先迭代看一下,而后再再场景里运行,确保迭代是正确的
作者:
sunshine_luo
时间:
2006-2-21 11:11
1。指出lz脚本的一个小问题:在一个脚本中最好不要定义两个相同的事务名,否则你在分析数据的时候会出现混乱;
2。lz说执行脚本功能是成功的,请问你是怎么判断这个脚本功能是成功的呢?
3。lz说的看到的界面是指在“view tree”中看到的界面么?
作者:
cxz1188
时间:
2006-2-21 14:47
标题:
情况是这样的
2。lz说执行脚本功能是成功的,请问你是怎么判断这个脚本功能是成功的呢?
我是在点击那个运行脚本的按钮,发现返回failed为0,全部pass
3。lz说的看到的界面是指在“view tree”中看到的界面么?
录制后在view tree显示的界面是正确的,但执行之后就全变成登录界面了??
作者:
sunshine_luo
时间:
2006-2-22 15:56
1。lz检查脚本是否执行成功的方法有点不妥,我认为不能单纯的看返回的是“failed”或者“pass”,而是应该去检查这个脚本要求实现的功能有没有实现
2。一时也看不出问题到底出在哪里,lz先说说当运行一次脚本后,脚本是否实现了需要的功能?
作者:
mailtolily
时间:
2006-2-23 15:07
可能要做SessionID关联。
作者:
sunfy
时间:
2006-3-3 09:15
1. 首先先确定一下你用户名的参数化设置是否正确?是不是每次迭代都用的不同的用户?你可以使用 lr_output_message 来查看用户参数化是否正确。
2. 如果上面没有问题,你可以试一试对这段代码进行参数化。 "jsessionid=B5B3505B0391E230C99AFDE30559E08A"
[
本帖最后由 sunfy 于 2006-3-3 09:19 编辑
]
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2