LoadRunner学习笔记(一)

into_login()
{

    /*设置登陆提交操作的集合点*/
 lr_rendezvous("login_rendezvous");


 web_url("login.asp",
  "URL=http://localhost/login.asp",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t4.inf",
  "Mode=HTML",
  LAST);

 web_submit_form("20050130_loginagine.asp",
  "Snapshot=t5.inf",
  ITEMDATA,
  "Name=username", "Value={username}", ENDITEM,
  "Name=password", "Value={password}", ENDITEM,
  "Name=Reg2", "Value=登录", ENDITEM,
  LAST);

 lr_start_transaction("confirm page");
/*该事务点的作用是统计登陆成功反馈信息*/

 lr_think_time(6);

 /*文本检查点默认是关闭的,需要手动开启,在Run setting 里Preferences -->Enable image and text*/
 /*设置发生错误,继续执行在Run setting里 General-->Miscellaneous-->Continue on error*/
 web_reg_find("Text=添加试题","SaveCount=num","Search=Body",LAST);
 web_link("添加试题",
  "Text=添加试题",
  "Snapshot=t6.inf",
  LAST);
 lr_end_sub_transaction( "confirm page",
  LR_AUTO );

 lr_log_message("用户名:%s", lr_eval_string("{username}"));
 lr_log_message("密  码:%s", lr_eval_string("{password}"));

 if(strcmp(lr_eval_string("{num}"),"0")==0)
 {
  lr_log_message("登陆失败");
 }
 else{
  lr_log_message("登陆成功");
 }


return 0;
}

posted @ 2010-06-08 11:20  superGG  阅读(364)  评论(0编辑  收藏  举报