51Testing软件测试论坛

标题: LR回放脚本,删除的动作虽然执行了但是实际并没有删除循环执行时新增的记录 [打印本页]

作者: 凛冬将至    时间: 2011-4-6 10:46
标题: LR回放脚本,删除的动作虽然执行了但是实际并没有删除循环执行时新增的记录
在SQL中查了之后发现,新增都是正常的,处方的编号每次都会+1,但是删除的动作每次都是读取第一次录制脚本时记录下来的处方编号,而不是读取每次新增后的那个新处方编号去删除,这样就导致处方越加越多,但是都没有删除,最后程序崩溃



请问这个是要在LR中做相关设置还是要编写相关脚本?还望高手指点
作者: archonwang    时间: 2011-4-6 14:15
想办法关联。最好把脚本附上来帮你看。
作者: 凛冬将至    时间: 2011-4-6 14:58
lr_start_transaction("chufang_xi_delete");

        web_custom_request("Recipe.ashx_75",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://192.168.200.6:8000/ManageOD/CheckRecipes.aspx?param=0&OperatorId=9999&tempRegInfoId=_TNBCOPYBK&HosId=1&PosId=9889",
                "Snapshot=t77.inf",
                "Mode=HTML",
                "EncType=text/xml",
                "Body=<args><operate>static_saverecipesinfos</operate><info_value><![CDATA[_TNBCOPYBK]]></info_value><isJZZ><![CDATA[0]]></isJZZ>\n<cfno><![CDATA[]]></cfno>\n</args>",
                LAST);

        web_custom_request("Recipe.ashx_76",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "Snapshot=t78.inf",
                "Mode=HTML",
                "EncType=text/xml",
                "Body=<args><operate>GetJzOrderFromUserId</operate><info_value><![CDATA[]]></info_value></args>",
                LAST);

        web_custom_request("Recipe.ashx_77",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "Snapshot=t79.inf",
                "Mode=HTML",
                "EncType=text/xml",
                "Body=<args><operate>getcurrentfenzhenstatue</operate><info_value><![CDATA[]]></info_value></args>",
                LAST);

        web_custom_request("Recipe.ashx_78",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=1",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "EncType=text/xml",
                "Body=<args><operate>gethissysinfo</operate><info_value><![CDATA[Outside_FZ]]></info_value></args>",
                LAST);

        web_custom_request("Recipe.ashx_79",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=1",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "EncType=text/xml",
                "Body=<args><operate>unloadtempreginfoid</operate><info_value><![CDATA[_TNBCOPYBK]]></info_value></args>",
                LAST);

        web_custom_request("ManageOD_WaitingDoctor,App_Web_waitingdoctor.aspx.a9916165.ashx_5",
                "URL=http://192.168.200.6:8000/ajaxpro/ManageOD_WaitingDoctor,App_Web_waitingdoctor.aspx.a9916165.ashx",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/plain",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "Snapshot=t80.inf",
                "Mode=HTML",
                "EncType=text/plain; charset=utf-8",
                "Body={\"xmlInfo\":\"<args><CardId></CardId><IS_SBK>0</IS_SBK><Name></Name><ddlState>1</ddlState><Item_Code></Item_Code><UsefulLife>0</UsefulLife><HosId>1</HosId><PosId>9889</PosId><OperatorId>9999</OperatorId><Is_UseJump>1</Is_UseJump><IsNeed_Detach>0</IsNeed_Detach><IsNeed_CallBigscreen>0</IsNeed_CallBigscreen><TempWaitingDoctorName>WaitingDoc_9999__UVXWK1QAX</TempWaitingDoctorName></args>\",\"pUId\":\"9999\"}",
                LAST);

        web_custom_request("Recipe.ashx_80",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "Snapshot=t81.inf",
                "Mode=HTML",
                "EncType=text/xml",
                "BodyBinary=<args><operate>loadtempreginfoid</operate><info_value><![CDATA[TEST1@鐢稝鍏ㄧ\xA7\x91涓\\x80鍐呯\xA7\x91@TEST1@07@27@@@@3101@0@@@2011-4-2 17:15:52@1001250116@鏈\xAC\xE5競鑷\xAA\xE8垂@2011-4-2 17:52:48@@9999@9999@0@@@@@1@@@_KY9DELSDB@@@@@@0@@@@TEST1@0000000000000000@0000000000000000@@@@@@@@@@@@0@]]></info_value></args>",
                LAST);

        web_custom_request("Recipe.ashx_81",
                "URL=http://192.168.200.6:8000/ManageOD/ashx/Recipe.ashx?OperatorId=9999&HosId=1&PosId=9889",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/xml",
                "Referer=http://192.168.200.6:8000/ManageOD/WaitingDoctor.aspx",
                "Snapshot=t82.inf",
                "Mode=HTML",
                "EncType=text/xml",
                "Body=<args><operate>GetJzOrderFromUserId</operate><info_value><![CDATA[]]></info_value></args>",
                LAST);

        lr_end_transaction("chufang_xi_delete",LR_AUTO);

        return 0;
}


这是删除那一段的脚本内容
作者: 凛冬将至    时间: 2011-4-6 15:17
在表请求后的一个REQUEST中(TREE模式下查看),有如下报错

无法显示 XML 页。
使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。


--------------------------------------------------------------------------------

文档的顶层无效。处理资源 'file:///D:/Program Files/Mercury/LoadRunner/scripts/全科2.0/健康档案/全科总院开方_删方_西药_TEST/data/t81.xml' 时出错。第 1 行,位...

_DBP6CRC5C
^

这好像不是关联有错误吧?脚本单次回放没有任何报错,事件全部为PASS
作者: 凛冬将至    时间: 2011-4-6 15:37
是否要把查询出来删除的那个处方编号做一下参数化处理,让它每次自动加1就能正常删除了?
作者: archonwang    时间: 2011-4-6 15:51
回复 5# 凛冬将至


按说的话,只要符合业务规则,直接修改这个处方编号参数就可以了。

——可以考虑用这个方法来处理。
作者: archonwang    时间: 2011-4-6 15:54
但是有个问题,你的业务流程是这样的么?
1. 新增处方
2. 删除处方

如果是这样的话,最好通过关联来处理删除(其中的原因基本上是不希望留下垃圾数据罢了)

另外,在你前台进行查询时,对于具体的功能删除可能是没有任何影响的,但是可以通过查询特定的参数来定义,所以,最好是能取到对应的处方编号来自动关联。即使是按序自增,在压力过程中,你也无法判断下一个增加的编号是多少。尝试下看看。
作者: 凛冬将至    时间: 2011-4-6 17:30
业务流程确实是这样的

新手,请问怎么手动关联?
现在关键是我不知道这段脚本里哪一个是取到的处方编号,还有很多地方中文是乱码
作者: caoying    时间: 2011-4-8 17:08
手动关联是用web_reg_save_param这个函数,看你的脚本中OperatorId=9999这个是需要删除的ID吧?你想办法找到响应中9999的左边界和右边界,把9999取出来放在一个变量里面,然后用这个变量去代替请求中的这个9999就可以了.




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