LoadRunner 常见错误收集及解决方案

发表于:2014-4-01 11:15

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:babyblue    来源:51Testing软件测试网采编

  一. 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 {
2
3         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);
10
11             } else {
12                 lr.end_transaction("searchItemList_man",lr.FAIL);
13             }
14             orderMap.clear();
15             productIdSet.clear();
16             productStatusList.clear();
17         } catch (Exception e) {
18
19
20             e.printStackTrace();
21         }
22
23
24         misc = null;
25         items = null;
26         return 0;
27     }//end of action
  解决办法:  在catch字句里加上一个 事务结束代码,修改后的catch段代码如下:
catch (Exception e) {
// TODO Auto-generated catch block
lr.end_transaction("searchItemList_man",lr.FAIL);
e.printStackTrace();
}
21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号