Loadrunner 输出内容到TXT文档

我的测试:

 int MyFile2;
 int LoginRes = 1;
 
//设置文档的位置
 char *addr1="E://myPass1101.txt";  

//是否输出的判断条件:请求是否返回success
LoginRes = web_reg_find("Text=success",LAST);


web_url("login.jsp",
		"URL=https://passport.sohu.com/sso/login.jsp?userid={newNun}%40sohu.com&password=9cbf8a4dcb8e30682b927f352d6559a0&appid=1019&persistentcookie=1&s=1330062132684&b=6&w=1440&pwdtype=1&v=26",
		"TargetFrame=",
		"Resource=0",
		"RecContentType=text/html",
		"Referer=http://i.sohu.com/login/logon.do",
		"Snapshot=t162.inf",
		"Mode=HTML",
	LAST);

//查看文件是否存在,如果不存在,输出错误
if((MyFile2= fopen(addr1,"a+"))==NULL)
	{ 
                lr_error_message("Can't open this file",addr1);
                return -1;
	}

//如果返回了success(成功则返回0)
if(LoginRes == 0)
	{
           	fprintf(MyFile2,"y%su/n",lr_eval_string("{newNun}"));  //writing datas to the file(filename)
 	}
 
//关闭文件
fclose(MyFile2);    
 

猜你喜欢

转载自leona-yang.iteye.com/blog/1733252