下载最新版loadrunner试用>>
一. This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement.
在做性能测试的时候,有时候会遇到下面的错误:This Vuser already started a transaction with the same name, and has not yet processed the corresponding lr_end_transaction statement. 解释:就是脚本中有一个事物开始了,但是没有结束事物,此时loadrunner就会 错,因为开始和结束是一一对应的,谁也不能把它们拆开,拆开了就会 错。 异常再现: 下列代码中,如果业务方法 了异常(Throw Exception),那么下面的if判断的代码不会被执行,而直接跳到catch子句里,那么已经开始的业务”searchItemList_man”就没有被结束,当你再次开始业务时,就会 错~
1 public int action() throws Throwable {23 misc = generateManItemSearchCondition();4 lr.start_transaction(“searchItemList_man”);5 try {6 //业务方法7 items = searchService.searchItemList(misc);8 if (items.isSuccess()) {9 lr.end_transaction(“searchItemList_man”,lr.PASS);1011 } else {12 lr.end_transaction(“searchItemList_man”,lr.FAIL);13 }14 orderMap.clear();15 productIdSet.clear();16 productStatusList.clear();17 } catch (Exception e) {181920 e.printStackTrace();21 }222324 misc = null;25 items = null;26 return 0;27 }//end of action |
解决办法: 在catch字句里加上一个 事务结束代码,修改后的catch段代码如下:
catch (Exception e) {// TODO Auto-generated catch blocklr.end_transaction(“searchItemList_man”,lr.FAIL);e.printStackTrace();} |
二.Function two_way_comm_post_message / two_way_comm_post_message_ex failed错误



1 Action()2 {34 //返回的字符串5 char resp_txt[200] = {0};6 //写入流的数据7 long myfile;8 //当前日期时间9 long now;10 …..11 ……1213 return 0;14 } |
解决方法及总结: 后将此三个变量注释之后问题解决. 结论:LR的脚本要注意内存的使用,尽量减少变量声明,对于char类型的变量要及时用free:即: 1 char * a; 2 free (a);下载最新版loadrunner试用>>
【年末回馈最后五天,赶紧抢,手慢无!】
活动时间:12月1日-12月31日
标签:性能测试测试优化loadRunner12
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!