51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1475|回复: 4
打印 上一主题 下一主题

[求助] 使用模拟用户运行,脚本自动停止,数据已成功插入到数据库

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2014-12-27 16:59:32 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 激流勇进 于 2014-12-27 17:59 编辑

脚本如下,用户注册,已使用参数化  ,脚本回放运行正常,数据成功进入到数据库,但使用械拟用户操作脚本,若不限制时间,脚本无限制运行,若限定运行时间,则到时间后直接停止,不知道为什么不显示成功
Action()
{

web_add_cookie("rememberMe=KichFaIIAz8+VvOX+vOKfkGwYUHsJhKdcjjh426VHYfcdzVL5AGY37Gh7/mtVs/RgI03mzrX1IyQ5f6XedhXQz5faP0X+cHxWqMhwvfhC9e0/1E7s/tJ9iXzG5w4VIjtGV+lp5G+E32q94sfLQAuiSrwc4IxlZDNVcrIMjb/nXmkfv0EE9izWM/Z/bw5ZSMwGYD+Zj/haHVwdFdErv63S7CqtFj5PfjZXQ+DlVABhOEUC8uoAI6hyd3xMgtIg882/x2xs1Y0quPRa6idY6YA9wXt20HYtb0cK+YCoNhjnrYRu9jLU89WNu/ufCrfiqgK/5Rb+Z/wZLBa8LYXaPXzgrlv80t3s7u5d4uRKr3ohOYSs+/h9mxPEj0JwZeBB0jnqSZhN+75h5IFvGln0yljjaGDh9OL2Dneuz7RAKooTvWuJfR2a4VjdRsa+ZexXT9yH5ph/"
"qWoVEvyq6OMdDIyzXy6tHEr0Yadk7XUPT8AHIXfDNZb4qk8h1v7Mh7r8XzvTJfKrmleuMz+jV5lVq+WQHQTd6LIlveypzQ3xbe5D834m/RkLFOjujO0Q4AFoG4w/hOlw9G5eZZJHofPCMIvwCXE22i5Y97IY9VmGC/6G1CFhuQ/pa6alWqYQsVJfZfVikggYKg5vj7wD2Cj1XKDHZ3FLnA9HpC9yWu0VUMqgWtcxQWncj/lYk+p4Ri8CGnzP8d34K2qxJ6GMBunPQP1jhKHa4LfXP4oCZZpV8icBWocW6ht1aH8Bv4YUaZNVqVxP0gvh4dfp0Rq4LUt3ndqgg==; DOMAIN=192.168.168.170");

web_url("192.168.168.170:8080",
"URL=http://192.168.168.170:8080/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t53.inf",
"Mode=HTML",
EXTRARES,
"Url=/resource/public/images/zhuye-img_01.gif", ENDITEM,
"Url=/resource/public/images/nav_pic.png", ENDITEM,
"Url=/resource/public/images/ggwsydl.png", ENDITEM,
"Url=/resource/public/images/111.png", ENDITEM,
"Url=/resource/public/images/zhuye-img_04.png", ENDITEM,
"Url=/resource/public/images/jianbian.png", ENDITEM,
"Url=/resource/public/images/dl.png", ENDITEM,
"Url=/resource/public/images/zc.png", ENDITEM,
"Url=/resource/public/images/zhuye-img_12.png", ENDITEM,
"Url=/resource/public/images/zhizuo-_01.png", ENDITEM,
LAST);

lr_think_time(34);

web_url("personalReg.jhtml",
"URL=http://192.168.168.170:8080/personalReg.jhtml",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t54.inf",
"Mode=HTML",
LAST);

lr_think_time(11);

lr_start_transaction("submit19");

web_submit_data("ajaxComValidReg.jhtml",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t55.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=", ENDITEM,
"Name=comfirmPwd", "Value=", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

web_submit_data("ajaxComValidReg.jhtml_2",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t56.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

web_submit_data("ajaxComValidReg.jhtml_3",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t57.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

lr_think_time(12);

web_submit_data("ajaxComValidReg.jhtml_4",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t58.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

lr_think_time(22);

web_submit_data("ajaxComValidReg.jhtml_5",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t59.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

lr_think_time(9);

web_submit_data("ajaxComValidReg.jhtml_6",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t60.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=", ENDITEM,
"Name=sex", "Value=woman", ENDITEM,
"Name=submit", "Value=nosubmit", ENDITEM,
LAST);

lr_think_time(9);

web_submit_data("ajaxComValidReg.jhtml_7",
"Action=http://192.168.168.170:8080/ajaxComValidReg.jhtml",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t61.inf",
"Mode=HTML",
"EncodeAtSign=YES",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=comfirmPwd", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=phoneNum", "Value=15872982589", ENDITEM,
"Name=email", "Value=123@123.com", ENDITEM,
"Name=sex", "Value=man", ENDITEM,
"Name=submit", "Value=submit", ENDITEM,
LAST);

lr_rendezvous("submitjhd19");


lr_end_transaction("submit19", LR_AUTO);


web_submit_data("192.168.168.170:8080_2",
"Action=http://192.168.168.170:8080/",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.168.170:8080/personalReg.jhtml",
"Snapshot=t62.inf",
"Mode=HTML",
ITEMDATA,
"Name=loginName", "Value={loginname19}", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=trueName", "Value=方茴19", ENDITEM,
"Name=idcard", "Value=", ENDITEM,
"Name=sex", "Value=man", ENDITEM,
EXTRARES,
"Url=/resource/public/images/tc.png", ENDITEM,
"Url=/resource/public/images/ggw-yhdlh.png", ENDITEM,
LAST);

return 0;
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2015-3-16 20:26:40 | 只看该作者
1、那个脚本是我测试用户注册功能录制的脚本,因登录名唯一,所以将登录名参数化了,其它的地方都没有改动。至于8个web_submit_data我也不太明白,内容差不多,我试过把那几个都合并到1个里面但回放脚本时失败了。
2、做性能测试时我如何辨别测试数据的正确性,会不会因为脚本不正确而导至结果不正确呢。
3、我很想在测试工具上有突破,我正在学习这本书《loadRunner性能测试实战》,按照书上操作总会出现这那的问题,不知道团长有没有好的方法及学习工具。
回复 支持 反对

使用道具 举报

  • TA的每日心情
    慵懒
    2019-9-27 12:46
  • 签到天数: 179 天

    连续签到: 1 天

    [LV.7]测试师长

    4#
    发表于 2014-12-29 22:26:40 | 只看该作者
    印象流:如果设定了持续时间,则结束后状态为stop。如果设定了循环次数,则结束后的状态为pass。

    如果设定了持续时间,则到了时间就会自动停止运行;

    看你的脚本里有8个web_submit_data,内容都差不多,你说的8个用户不会是指这个吧?

    还有,你脚本里的集合点的位置好奇怪啊。

    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2014-12-29 17:33:25 | 只看该作者
    嗯,在题问方面还有待提高。问题是脚本为什么自动停止运行,没有一条执行成功,同时并发8个用户,共写入8条数据,有3条已成功插入数据库。想知道如何让该脚本运行结果为pass
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    慵懒
    2019-9-27 12:46
  • 签到天数: 179 天

    连续签到: 1 天

    [LV.7]测试师长

    2#
    发表于 2014-12-28 15:34:21 | 只看该作者
    没看明白问题是什么
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-11-24 01:27 , Processed in 0.065502 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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