Error: Vuser started transaction “登录“, but did not reached a corresponding end transaction statement

为LoadRunner12生成的脚本插入登录检查点运行之后报了这个错误

修改之前的代码如下:

	web_concurrent_start(NULL);
	lr_start_transaction("开始登录");//事务开始

	web_reg_find("Fail=NotFound",
		"Search=Body",
		"SaveCount=loginCheck",
		"Text=Welcome",
		LAST);//检查点,判断登录之后的页面中的Body部分是否包含Welcome

	web_url("login.pl_2", 
		"URL=http://localhost:1080/cgi-bin/login.pl?intro=true", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://localhost:1080/cgi-bin/login.pl", 
		"Snapshot=t72.inf", 
		"Mode=HTTP", 
		LAST);

	web_url("nav.pl_2", 
		"URL=http://localhost:1080/cgi-bin/nav.pl?page=menu&in=home", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://localhost:1080/cgi-bin/login.pl", 
		"Snapshot=t73.inf", 
		"Mode=HTTP", 
		LAST);
	web_concurrent_end(NULL);
	
	if((atoi(lr_eval_string("{loginCheck}")))>0){
		lr_end_transaction("登录成功", LR_PASS);//事务结束
	}else{
		lr_end_transaction("登录失败", LR_FAIL);//事务结束
	}/* 判断{loginCheck}是否包含了需要检查的文段,页面中包含了说明登录
	成功,没有包含则登录失败. lr_eval_string指返回脚本参数中的值,
	lr_eval_string("{loginCheck}")就是返回参数loginCheck的值;
	atoi是把字符串转换成整型数。*/

修改之后的代码:

	web_concurrent_start(NULL);
	lr_start_transaction("开始登录");

	web_reg_find("Fail=NotFound",
		"Search=Body",
		"SaveCount=loginCheck",
		"Text=Welcome",
		LAST);

	web_url("login.pl_2", 
		"URL=http://localhost:1080/cgi-bin/login.pl?intro=true", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://localhost:1080/cgi-bin/login.pl", 
		"Snapshot=t72.inf", 
		"Mode=HTTP", 
		LAST);

	web_url("nav.pl_2", 
		"URL=http://localhost:1080/cgi-bin/nav.pl?page=menu&in=home", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=http://localhost:1080/cgi-bin/login.pl", 
		"Snapshot=t73.inf", 
		"Mode=HTTP", 
		LAST);
	web_concurrent_end(NULL);
	
	if((atoi(lr_eval_string("{loginCheck}")))>0){
		lr_end_transaction("开始登录", LR_PASS);
	}else{
		lr_end_transaction("开始登录", LR_FAIL);
	}
	

两段代码的区别在于,lr_start_transaction(“开始登录”)lr_end_transaction(“开始登录”, LR_PASS) 的文字说明部分,这里需要改成一样的。
修改之后就没有这个错误了。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值