51Testing软件测试论坛
标题:
请大家帮忙解决!
[打印本页]
作者:
森林一木
时间:
2007-12-23 14:26
标题:
请大家帮忙解决!
大家好,在学习LOADRUNNER的过程中遇到如下问题;
本次脚本是录制一个在线考试系统,自动生成试题后,考生答题,然后提交的过程.
1,在下面的脚本中,红色字体中的id每次都会自动变化,并且每一个用户登陆后生成的id都不一样,经过分析,这个id是递增的,每次试题共15题,id也是从某一个数字递增,可做参数化,但做后有一个问题是:这个id与页面信息不匹配(web_url()中的值),就是说试题的id虽然是递增的,但是并没有按照一个升序或降序的方法排列,导致测试过程中,页面名称与实际试题id对不上,无法起到参数化的效果.
罗嗦了很多,不晓得大家能否明白我的意思.现在需要解决的是如何将这个问题解决,能让参数化起到效果.
submitexam()
{
lr_think_time(10);
web_url("test_saveanswer.asp",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&
id=1833
",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_2",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1834",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_3",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1844",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_4",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1839",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_5",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1843",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_6",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1840",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_7",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1832",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_8",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1837",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_9",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1836",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_10",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1835",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_11",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1838",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_12",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1846",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_13",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1845",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_14",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1842",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(10);
web_url("test_saveanswer.asp_15",
"URL=http://192.168.0.103/exam/test_saveanswer.asp?answer=1&id=1841",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
lr_think_time(20);
web_url("testfinish.asp",
"URL=http://192.168.0.103/exam/testfinish.asp?action=submitexam&prjid=23&studentid=222",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t6.inf",
"Mode=HTML",
LAST);
return 0;
}
[
本帖最后由 森林一木 于 2007-12-23 14:27 编辑
]
作者:
Zee
时间:
2007-12-23 20:41
用关联吧。
作者:
NODDY820
时间:
2007-12-23 22:25
也许,你只需要作关联,这些ID是页面中的脚本产生的,你 参数化也没用,实际提交的ID还是脚本生成的
作者:
森林一木
时间:
2007-12-23 23:31
谢楼上二位,我用了笨方法,改了生成页面的代码,做了一个排序,这样使用参数化能够顺序读取数据。
采纳二位的建议,用关联试试。多谢。
作者:
森林一木
时间:
2008-1-3 10:02
关联搞不定的。这里没有可以关联的地方。有无其他办法?
作者:
eden_guo
时间:
2008-1-3 14:03
你可以尝试参数化之后,再进行 字符串的拼接.然后完成你所要的操作.
不然.我不知道你具体的系统是怎样的.或许有某个地方可以 获取到 那个id num
你再进行尝试吧
作者:
jiangtianwuchen
时间:
2008-1-4 11:52
在前面加上web_create_html_param()
作者:
森林一木
时间:
2008-1-4 23:47
楼上朋友可否说的详细点?
作者:
54111
时间:
2008-1-5 09:27
关注中
作者:
shhuangfy
时间:
2009-3-13 14:40
最终如何解决的呢?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2