51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1911|回复: 6
打印 上一主题 下一主题

[原创] 回放脚本时怎么不发帖呢?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-11-15 18:28:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
刚学Loadrunner,自己搭了个Tomcat,放了个jsp的论坛,刚刚录了个脚本。主要步骤如下:
打开页面-登陆-默认版块-发帖-退出。脚本如下,参数化文件内有200条数据
Action()
{
web_url("sddns2.cncmax.cn:8080",
  "URL=http://sddns2.cncmax.cn:8080/?HOST=wpad.router&R=/wpad.dat&",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t1.inf",
  "Mode=HTML",
  LAST);
// web_add_cookie("smile=1D1; DOMAIN=localhost");
// web_add_cookie("jrun_cookietime=2592000; DOMAIN=localhost");
// web_add_cookie("jrun_sid=I9leLc; DOMAIN=localhost");
web_url("JspRun",
  "URL=http://localhost:8080/JspRun",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t2.inf",
  "Mode=HTML",
  EXTRARES,
  "Url=/JspRun/forumdata/cache/style_1.css", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/forumdata/cache/style_1_append.css", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/link.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/online.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/menu_itemline.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/arrow_down.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/forumbox_head.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/portalbox_bg.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/wrap_shadow.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/header.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/menubg.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/footer_shadow.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  "Url=/JspRun/images/default/dropmenubg.gif", "Referer=http://localhost:8080/JspRun/", ENDITEM,
  LAST);
lr_think_time(7);
web_submit_data("logging.jsp",
  "Action=http://localhost:8080/JspRun/logging.jsp?action=login&loginsubmit=true",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://localhost:8080/JspRun/",
  "Snapshot=t3.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=formHash", "Value=07fdbc14", ENDITEM,
  "Name=cookietime", "Value=2592000", ENDITEM,
  "Name=accessing", "Value=logging", ENDITEM,
  "Name=loginfield", "Value=username", ENDITEM,
  "Name=username", "Value=guest", ENDITEM,
  "Name=password", "Value=guest", ENDITEM,
  "Name=userlogin", "Value=鐧诲綍", ENDITEM,
  LAST);
// web_link("如果您的浏览器没有自动跳转,请点击这里",
//  "Text=如果您的浏览器没有自动跳转,请点击这里",
//  "Snapshot=t4.inf",
//  EXTRARES,
//  "Url=forumdata/cache/style_1.css", ENDITEM,
//  "Url=forumdata/cache/style_1_append.css", ENDITEM,
//  "Url=images/default/link.gif", ENDITEM,
//  "Url=images/default/online.gif", ENDITEM,
//  "Url=images/default/menu_itemline.gif", ENDITEM,
//  "Url=images/default/arrow_down.gif", ENDITEM,
//  "Url=images/default/forumbox_head.gif", ENDITEM,
//  "Url=images/default/portalbox_bg.gif", ENDITEM,
//  "Url=images/default/wrap_shadow.gif", ENDITEM,
//  "Url=images/default/header.gif", ENDITEM,
//  "Url=images/default/menubg.gif", ENDITEM,
//  "Url=images/default/footer_shadow.gif", ENDITEM,
//  "Url=images/default/dropmenubg.gif", ENDITEM,
//  LAST);
web_link("默认版块",
  "Text=默认版块",
  "Snapshot=t5.inf",
  EXTRARES,
  "Url=images/default/folder_s.gif", "Referer=http://localhost:8080/JspRun/forumdisplay.jsp?fid=2", ENDITEM,
  "Url=images/default/tradesmall_m.gif", "Referer=http://localhost:8080/JspRun/forumdisplay.jsp?fid=2", ENDITEM,
  "Url=images/default/debatesmall_m.gif", "Referer=http://localhost:8080/JspRun/forumdisplay.jsp?fid=2", ENDITEM,
  "Url=images/default/arrow_left.gif", "Referer=http://localhost:8080/JspRun/forumdisplay.jsp?fid=2", ENDITEM,
  LAST);
web_link("发新话题",
  "Text=发新话题",
  "Snapshot=t6.inf",
  EXTRARES,
  "Url=forumdata/cache/smilies_var.js?0.9575768225658263", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/smile.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/lol.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/hug.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/victory.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/time.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/kiss.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/handshake.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/call.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/loveliness.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/mad.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/sweat.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/sad.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/biggrin.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/cry.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/huffy.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  "Url=images/smilies/default/shocked.gif", "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1", ENDITEM,
  LAST);
web_submit_data("post.jsp",
  "Action=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&page=&topicsubmit=yes&formHash=04024fcf",
  "Method=POST",
  "EncType=multipart/form-data",
  "RecContentType=text/html",
  "Referer=http://localhost:8080/JspRun/post.jsp?action=newthread&fid=2&extra=page%3D1",
  "Snapshot=t7.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=formHash", "Value=04024fcf", ENDITEM,
  "Name=isblog", "Value=", ENDITEM,
  "Name=frombbs", "Value=1", ENDITEM,
  "Name=subject", "Value={topic}", ENDITEM,
  "Name=posteditor_mediatyperadio", "Value=on", ENDITEM,
  "Name=message", "Value={content}", ENDITEM,
  "Name=previewbutton", "Value=预览帖子", ENDITEM,
  "Name=tags", "Value=", ENDITEM,
  "Name=iconid", "Value=0", ENDITEM,
  "Name=wysiwyg", "Value=0", ENDITEM,
  EXTRARES,
  "Url=images/default/forumlink.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/default/buddy_sendpm.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/default/user_add.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/default/user_online.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/default/jpbg.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/common/editor.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=forumdata/cache/smilies_var.js?0.7141267974347238", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  "Url=images/default/headactions_line.gif", "Referer=http://localhost:8080/JspRun/viewthread.jsp?tid=4&frombbs=1", ENDITEM,
  LAST);
web_link("退出",
  "Text=退出",
  "Snapshot=t8.inf",
  EXTRARES,
  "Url=images/default/menulibg.gif", "Referer=http://localhost:8080/JspRun/logging.jsp?action=logout&formhash=DP9HRHUB", ENDITEM,
  LAST);
return 0;
}

回放时没有红色的字,但是打开论坛怎么看不到帖子呢?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2010-11-15 18:30:47 | 只看该作者
自己先顶下
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2010-11-16 09:34:07 | 只看该作者
1、用户参数化了没?
2、虚拟用户有至少200个吗?
3、一个帖子都看不到吗?
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2010-11-16 10:04:13 | 只看该作者
回放时迭代2次,论坛能看到帖子不
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2010-11-16 11:25:49 | 只看该作者
发帖是否有验证码呢?
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2010-11-16 14:37:15 | 只看该作者
发帖不成功,手工发一个试试,如果成功,则是LR的问题,看是否有验证码,或有发帖间隔时间限制等代码限制条件,我测试BBS的时候就因为这两个问题,或是登陆没成功  等等。。。。压的时候把所有条件限制都去掉
回复 支持 反对

使用道具 举报

该用户从未签到

7#
发表于 2010-11-16 14:43:56 | 只看该作者
回复 1# androidone
另外建议你在脚本录制的时候选项选择基于URL选项,把图片和文本内容的请求筛选掉

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-17 10:42 , Processed in 0.069547 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表