tangxuelian 发表于 2016-7-13 14:28:46

loadrunner 录制脚本后,做了关联,参数化,检查点,但是跑场景数据没有入库

我新录制的注册页面的脚本,做了关联,检查点,参数化,回放显示成功,但是跑场景的时候数据库中实际没有数据进去,有哪位大神可以帮忙看一下的,刚新手上路~~~~

Action()
{
web_url("register.html", 
"URL=http://192.168.1.90:8100/emall/public/register.html", 
"Resource=0", 
"RecContentType=text/html", 
"Referer=", 
"Snapshot=t2.inf", 
"Mode=HTTP", 
LAST);

web_url("ValidateCode", 
"URL=http://192.168.1.90:8100/site/Account/ValidateCode", 
"Resource=1", 
"RecContentType=image/jpeg", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t21.inf", 
LAST);

web_concurrent_end(NULL);

web_custom_request("AreaList", 
"URL=http://192.168.1.90:8100/site/Area/AreaList", 
"Method=POST", 
"Resource=0", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t22.inf", 
"Mode=HTTP", 
"EncType=", 
LAST);

lr_start_transaction("register");

lr_think_time(21);

web_submit_data("AreaList_2", 
"Action=http://192.168.1.90:8100/site/Area/AreaList", 
"Method=POST", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t23.inf", 
"Mode=HTTP", 
ITEMDATA, 
"Name=parentId", "Value=110000", ENDITEM, 
LAST);

web_submit_data("AreaList_3", 
"Action=http://192.168.1.90:8100/site/Area/AreaList", 
"Method=POST", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t24.inf", 
"Mode=HTTP", 
ITEMDATA, 
"Name=parentId", "Value=110100", ENDITEM, 
LAST);

web_submit_data("AreaList_4", 
"Action=http://192.168.1.90:8100/site/Area/AreaList", 
"Method=POST", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t25.inf", 
"Mode=HTTP", 
ITEMDATA, 
"Name=parentId", "Value=110101001", ENDITEM, 
LAST);

lr_think_time(8);

web_url("CheckLoginName", 
"URL=http://192.168.1.90:8100/site/Account/CheckLoginName?LoginName={name}&_=1468377426994", 
"Resource=0", 
"RecContentType=text/html", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t26.inf", 
"Mode=HTTP", 
LAST);

web_concurrent_start(NULL);

web_url("CheckMobileForReg", 
"URL=http://192.168.1.90:8100/site/Account/CheckMobileForReg?cellPhone={phone}&_=1468377426995", 
"Resource=1", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t27.inf", 
LAST);

web_url("CheckMobileForReg_2", 
"URL=http://192.168.1.90:8100/site/Account/CheckMobileForReg?cellPhone={phone}&_=1468377426996", 
"Resource=1", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t28.inf", 
LAST);

web_url("ValidateCode_2", 
"URL=http://192.168.1.90:8100/site/Account/ValidateCode?shuiji=0.18276340869018254", 
"Resource=1", 
"RecContentType=image/jpeg", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t29.inf", 
LAST);

web_concurrent_end(NULL);

lr_think_time(13);

web_reg_save_param("errorinfo",
"LB={",
"RB=,\"Proposal\"",
LAST);

web_reg_save_param("check",
"LB=\"Code\":",
"RB=,",
LAST);

web_submit_data("GenSmsCode", 
"Action=http://192.168.1.90:8100/site/Account/GenSmsCode", 
"Method=POST", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t30.inf", 
"Mode=HTTP", 
ITEMDATA, 
"Name=cellPhone", "Value={phone}", ENDITEM, 
"Name=ImageCheckCode", "Value=aaaa", ENDITEM, 
LAST);

web_submit_data("RegisterEnterprise", 
"Action=http://192.168.1.90:8100/site/Account/RegisterEnterprise", 
"Method=POST", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/register.html", 
"Snapshot=t31.inf", 
"Mode=HTTP", 
ITEMDATA, 
"Name=Enterprise", "Value={name}", ENDITEM, 
"Name=Province", "Value=110000", ENDITEM, 
"Name=City", "Value=110100", ENDITEM, 
"Name=County", "Value=110101", ENDITEM, 
"Name=AreaCode", "Value=110101001", ENDITEM, 
"Name=LoginName", "Value={name}", ENDITEM, 
"Name=Password", "Value=a123123", ENDITEM, 
"Name=ConfirmPassword", "Value=a123123", ENDITEM, 
"Name=SmsCode", "Value=123123", ENDITEM, 
"Name=CellPhone", "Value={phone}", ENDITEM, 
"Name=CompanyProperty", "Value=1", ENDITEM, 
"Name=ImageCheckCode", "Value=aaaa", ENDITEM, 
"Name=InvitationCode", "Value=", ENDITEM, 
LAST);


web_reg_find("Fail=NotFound",
"SaveCount=count",
"Text=您已完成注册!",
LAST);


web_url("regSuccess.html", 
"URL=http://192.168.1.90:8100/emall/public/regSuccess.html", 
"Resource=0", 
"RecContentType=text/html", 
"Referer=", 
"Snapshot=t32.inf", 
"Mode=HTTP", 
LAST);

web_concurrent_start(NULL);

web_url("icon.png", 
"URL=http://192.168.1.90:8100/emall/images/icon.png", 
"Resource=1", 
"RecContentType=image/png", 
"Referer=http://192.168.1.90:8100/emall/public/regSuccess.html", 
"Snapshot=t33.inf", 
LAST);

web_url("GetUserBasicInfo_2", 
"URL=http://192.168.1.90:8100/site/Account/GetUserBasicInfo?_=1468377478812", 
"Resource=1", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/regSuccess.html", 
"Snapshot=t34.inf", 
LAST);

web_url("List_2", 
"URL=http://192.168.1.90:8100/site/Links/List?_=1468377478813", 
"Resource=1", 
"RecContentType=application/json", 
"Referer=http://192.168.1.90:8100/emall/public/regSuccess.html", 
"Snapshot=t35.inf", 
LAST);

web_concurrent_end(NULL);

 if(atoi(lr_eval_string("{check}"))==0)
lr_end_transaction("register", LR_PASS);
else 
{
lr_end_transaction("register", LR_FAIL);
lr_error_message(lr_eval_string("{errorinfo}"));
}

return 0;
}

jingzizx 发表于 2016-7-13 16:34:20

先保证在你做这些工作之前,脚本能够插入数据,看看后台服务器是否抱错,查看原因

花总丢了金箍棒 发表于 2016-7-13 16:53:33

web_submit_data("RegisterEnterprise",
"Action=http://192.168.1.90:8100/site/Account/RegisterEnterprise",
"Method=POST",
"RecContentType=application/json",
"Referer=http://192.168.1.90:8100/emall/public/register.html",
"Snapshot=t31.inf",
"Mode=HTTP",
ITEMDATA,
"Name=Enterprise", "Value={name}", ENDITEM,
"Name=Province", "Value=110000", ENDITEM,
"Name=City", "Value=110100", ENDITEM,
"Name=County", "Value=110101", ENDITEM,
"Name=AreaCode", "Value=110101001", ENDITEM,
"Name=LoginName", "Value={name}", ENDITEM,
"Name=Password", "Value=a123123", ENDITEM,
"Name=ConfirmPassword", "Value=a123123", ENDITEM,
"Name=SmsCode", "Value=123123", ENDITEM,
"Name=CellPhone", "Value={phone}", ENDITEM,
"Name=CompanyProperty", "Value=1", ENDITEM,
"Name=ImageCheckCode", "Value=aaaa", ENDITEM,
"Name=InvitationCode", "Value=", ENDITEM,
LAST);


执行这个,看是否入库。是否有遗漏的需要关联的没关联。虽是post,拿get调下,看看是否成功。成功的话,那就应该没问题

tangxuelian 发表于 2016-7-13 16:53:54

录制可以插入数据的,回放也显示成功,但是数据没有入库,设置场景跑也没有数据入库
Action.c(316): Registering web_reg_find was successful       
Action.c(322): Registered web_reg_find successful for "Text=您已完成注册!" (count=1)       
Action.c(322): web_url("regSuccess.html") was successful, 2428 body bytes, 303 header bytes       
Action.c(331): web_concurrent_start was successful       
Action.c(333): Registering web_url("icon.png") was successful       
Action.c(341): Registering web_url("GetUserBasicInfo_2") was successful       
Action.c(349): Registering web_url("List_2") was successful       
Action.c(357): web_concurrent_end was successful, 24410 body bytes, 947 header bytes       
Action.c(360): Notify: Transaction "register" ended with "Pass" status (Duration: 9.8553 Wasted Time: 0.0393).
Ending action Action.
Ending iteration 1.

花总丢了金箍棒 发表于 2016-7-14 15:53:57

tangxuelian 发表于 2016-7-13 16:53
录制可以插入数据的,回放也显示成功,但是数据没有入库,设置场景跑也没有数据入库
Action.c(316): Regis ...

哎呦,这明显不符合逻辑么,你不录制,手动操作一遍,看看能入库么?不会是程序有问题吧。就没有插入的操作。如果手动可以,哪脚本成功,应该就ok的才对呀。。

samraul 发表于 2016-7-15 10:28:23

本帖最后由 samraul 于 2016-7-15 10:31 编辑

我估计你没注册成功,你看下“您已完成注册!" 那一页的录制快照,看看是正常显示完成注册还是报错


说错了,是看回放快照

tangxuelian 发表于 2016-7-16 09:52:21

找到原因了,是手机验证码没通过,各位大神知道loadrunner怎么录制手机验证码么

tangxuelian 发表于 2016-7-16 09:52:29

找到原因了,是手机验证码没通过,各位大神知道loadrunner怎么录制手机验证码么

fhhh_eyou 发表于 2016-7-17 10:21:45

1.数据取值一个可以在数据库。
2.也可以值用文本取值。
实现方式可以灵活。
你实现的参数化变量是正确的?

fhhh_eyou 发表于 2016-7-17 10:21:56

1.数据取值一个可以在数据库。
2.也可以值用文本取值。
实现方式可以灵活。
你实现的参数化变量是正确的?

狼人本色 发表于 2017-3-22 02:10:42

胸弟,关于验证码,LR就基本解决不了的!!!因为LR识别不了验证码的图片或者复杂形式的验证码,如果是公司的,就让开发人员给个万能验证码!!
页: [1]
查看完整版本: loadrunner 录制脚本后,做了关联,参数化,检查点,但是跑场景数据没有入库