51Testing软件测试论坛

标题: LR参数化时遇到的问题 [打印本页]

作者: Kadar    时间: 2011-9-1 14:33
标题: LR参数化时遇到的问题
下面两个需要做参数化,其中instoreHead.id代表数据库的对应instoreCode的ID,
"Name=instoreHead.id", "Value=74"---数据库中对应下面入库编号的ID,
"Name=instoreCode", "Value=201108RK0065"---入库编号,流水号
上面两个数据在执行脚本后会往数据库中新增对应的“201108RK0065”这条记录,对应的ID为:74。
我现在参数化上面两个数据,使用Data Wizard参数化入库编号,可是网上搜索一下,说用Data Wizard不能自动更新数据,这样的话我测试过程中就没有办法取到我最新增加的入库记录的编号了,那参数化对我的测试就起不到作用了,有什么办法能够自动更新,让我取到最新增加的那条记录的入库编号吗?谢谢诶
作者: msnshow    时间: 2011-9-1 21:33
要使用关联来实现
作者: Kadar    时间: 2011-9-7 10:26
下面是全部脚本内容:

web_url("loginAction.action",
  "URL=http://192.168.1.60:82/biology/loginAction.action",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t1.inf",
  "Mode=HTML",
  LAST);

web_submit_form("loginAction.action;jsessionid=26F0B68273303DA35F8D4926F5E3ED33",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=loginName", "Value=ADMIN", ENDITEM,
  "Name=loginPassword", "Value=ADMIN", ENDITEM,
  "Name=x", "Value=16", ENDITEM,
  "Name=y", "Value=8", ENDITEM,
  EXTRARES,
  "Url=image/folder.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/base.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/plus.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/join.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/page.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/joinbottom.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/plusbottom.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/empty.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/line.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/folderopen.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  "Url=image/minus.gif", "Referer=http://192.168.1.60:82/biology/Left.jsp", ENDITEM,
  LAST);

web_url("Top.jsp",
  "URL=http://192.168.1.60:82/biology/Top.jsp",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://192.168.1.60:82/biology/Main.jsp",
  "Snapshot=t4.inf",
  "Mode=HTML",
  LAST);

web_url("showAddInstoreStraight.action",
  "URL=http://192.168.1.60:82/biology/bio/circulation/showAddInstoreStraight.action?modId=21&firstTime=yes",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://192.168.1.60:82/biology/Left.jsp",
  "Snapshot=t5.inf",
  "Mode=HTML",
  EXTRARES,
  "Url=/biology/images/buttontwo.gif", "Referer=http://192.168.1.60:82/biology/bio/circulation/showAddInstoreStraight.action?modId=21&firstTime=yes", ENDITEM,
  LAST);

web_custom_request("BacterinService.searchBacterins.dwr",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/BacterinService.searchBacterins.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t7.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554350\nc0-scriptName=BacterinService\nc0-methodName=searchBacterins\nc0-id=0\nc0-e1=string:\nc0-param0=Object_Object:{bacterinSort:reference:c0-e1}\nbatchId=0\n",
  LAST);

web_custom_request("CascadeSelectService.basePurveyUnitSelectFactory.dwr",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/CascadeSelectService.basePurveyUnitSelectFactory.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t8.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554350\nc0-scriptName=CascadeSelectService\nc0-methodName=basePurveyUnitSelectFactory\nc0-id=0\nc0-e1=string:1\nc0-e2=string:\nc0-e3=string:1\nc0-param0=Object_Object:{organId:reference:c0-e1, purveyId:reference:c0-e2, extraOption:reference:c0-e3}\nbatchId=1\n",
  LAST);

web_custom_request("CascadeSelectService.baseFactorySelectPurveyUnit.dwr",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/CascadeSelectService.baseFactorySelectPurveyUnit.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t9.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554350\nc0-scriptName=CascadeSelectService\nc0-methodName=baseFactorySelectPurveyUnit\nc0-id=0\nc0-e1=string:1\nc0-e2=string:\nc0-e3=string:1\nc0-param0=Object_Object:{organId:reference:c0-e1, factoryId:reference:c0-e2, extraOption:reference:c0-e3}\nbatchId=2\n",
  LAST);

//点击数据显示列表框里的【确定按钮
//该inStoreCode的值为入库编号,需要处理的字段
lr_start_transaction("点击事务");
web_url("showInStoreDetail.action",
  "URL=http://192.168.1.60:82/biology/bio/circulation/showInStoreDetail.action?inStoreCode=201109RK0001",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t10.inf",
  "Mode=HTML",
  LAST);

//点击【确认】后,页面跳至确认入库的页面
lr_start_transaction("点击确认入库事务");

web_submit_data("checkInstore.action",
  "Action=http://192.168.1.60:82/biology/bio/circulation/checkInstore.action",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreDetail.action?inStoreCode=201109RK0001",
  "Snapshot=t11.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=instoreHead.id", "Value=98", ENDITEM, //instoreHead.id为数据库中对应inStoreCode的ID,应该要同时处理。
  "Name=instoreCode", "Value=201109RK0001", ENDITEM,
  LAST);

web_custom_request("BacterinService.searchBacterins.dwr_2",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/BacterinService.searchBacterins.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t12.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554595\nc0-scriptName=BacterinService\nc0-methodName=searchBacterins\nc0-id=0\nc0-e1=string:\nc0-param0=Object_Object:{bacterinSort:reference:c0-e1}\nbatchId=0\n",
  LAST);

web_custom_request("CascadeSelectService.basePurveyUnitSelectFactory.dwr_2",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/CascadeSelectService.basePurveyUnitSelectFactory.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t13.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554595\nc0-scriptName=CascadeSelectService\nc0-methodName=basePurveyUnitSelectFactory\nc0-id=0\nc0-e1=string:1\nc0-e2=string:\nc0-e3=string:1\nc0-param0=Object_Object:{organId:reference:c0-e1, purveyId:reference:c0-e2, extraOption:reference:c0-e3}\nbatchId=1\n",
  LAST);

web_custom_request("CascadeSelectService.baseFactorySelectPurveyUnit.dwr_2",
  "URL=http://192.168.1.60:82/biology/dwr/call/plaincall/CascadeSelectService.baseFactorySelectPurveyUnit.dwr",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/javascript",
  "Referer=http://192.168.1.60:82/biology/bio/circulation/showInStoreList.action",
  "Snapshot=t14.inf",
  "Mode=HTML",
  "EncType=text/plain",
  "Body=callCount=1\npage=/biology/bio/circulation/showInStoreList.action\nhttpSessionId=26F0B68273303DA35F8D4926F5E3ED33\nscriptSessionId=8A2516F349C12996BDBEA97370E70554595\nc0-scriptName=CascadeSelectService\nc0-methodName=baseFactorySelectPurveyUnit\nc0-id=0\nc0-e1=string:1\nc0-e2=string:\nc0-e3=string:1\nc0-param0=Object_Object:{organId:reference:c0-e1, factoryId:reference:c0-e2, extraOption:reference:c0-e3}\nbatchId=2\n",
  LAST);

lr_end_transaction("点击确认入库事务",LR_AUTO);

通过关联该怎么做呢,昨天我在网上找来个资料,按照资料去做,没有成功。
作者: 1987wing    时间: 2011-9-7 11:30
id和编号是你自己定吗?

如果是自己定的,id作为一个参数进行参数化,inStoreCode作为另一个参数进行参数化
第二次用到inStoreCode参数时,用{inStoreCode}进行取值
作者: Kadar    时间: 2011-9-7 14:22
回复 4# 1987wing


嗯,谢谢,成功了!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2