51Testing软件测试论坛
标题:
登陆脚本不解之处
[打印本页]
作者:
dhh45
时间:
2010-4-15 11:33
标题:
登陆脚本不解之处
#include "as_web.h"
Action()
{
int ii=1;
web_url("caseim",
"URL=http://32.1.2.244:9080/caseim/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
EXTRARES,
"Url=images/loginback.jpg", ENDITEM,
"Url=images/14%E4%B8%AA%E5%9C%B0%E5%B8%82%E7%9A%84%E5%9B%BE%E7%89%87/%E7%9C%81%E5%8E%85/login_06.gif", ENDITEM,
"Url=images/f_txt.swf", "Referer=", ENDITEM,
LAST);
lr_think_time( 1 );
ii=web_submit_form("select.jsp",
"Snapshot=t4.inf",
ITEMDATA,
"Name=account", "Value={NewParam_1000}", ENDITEM,/*登陆用户参数,有5个,其中数据库中不存在第三个数据*/
"Name=pwd", "Value=1", ENDITEM, /*登陆用户密码都为1*/
EXTRARES,
"Url=images/14%E4%B8%AA%E5%9C%B0%E5%B8%82%E7%9A%84%E5%9B%BE%E7%89%87/%E7%9C%81%E5%8E%85/select.jpg", ENDITEM,
"Url=images/loginback2.jpg", ENDITEM,
"Url=images/f_txt.swf", "Referer=", ENDITEM,
"Url=images/index_but_out.gif", ENDITEM,
"Url=images/index_but_over.gif", ENDITEM,
LAST);
if(ii==0)
{web_link("管理系统",
"Text=管理系统",
"Snapshot=t5.inf",
EXTRARES,
"Url=images/banner1.swf", "Referer=", ENDITEM,
"Url=images/14%E4%B8%AA%E5%9C%B0%E5%B8%82%E7%9A%84%E5%9B%BE%E7%89%87/%E7%9C%81%E5%8E%85/top_03.gif", "Referer=http://32.1.2.244:9080/caseim/head.jsp", ENDITEM,
"Url=images/index_bg1_03.gif", "Referer=http://32.1.2.244:9080/caseim/head.jsp", ENDITEM,
"Url=images/mainpage_1_03.gif", "Referer=http://32.1.2.244:9080/caseim/main.jsp", ENDITEM,
"Url=images/mainpage_1_05.gif", "Referer=http://32.1.2.244:9080/caseim/main.jsp", ENDITEM,
"Url=images/mainpage_1_07.gif", "Referer=http://32.1.2.244:9080/caseim/main.jsp", ENDITEM,
"Url=images/mainpage_1_06.gif", "Referer=http://32.1.2.244:9080/caseim/main.jsp", ENDITEM,
"Url=images/mainpage_1_08.gif", "Referer=http://32.1.2.244:9080/caseim/main.jsp", ENDITEM,
LAST);
lr_log_message(">>>>>>>>>>>>>>>>>>>>>>>>>登陆成功");
}
else
{lr_log_message(">>>>>>>>>>>>>>>>>>>>>>>error");}
return 0;
}
错误数据测试报告显示第三个数据失败,但日志中不打印>>>>>>>>>>>>>>>>>>>>>>>error,不知道为什么走不到else中去?????其他数据显示成功,日志中打印>>>>>>>>>>>>>>>>>>>>>>>>>登陆成功
作者:
skyzhu
时间:
2010-4-15 11:45
web_submit_form只要执行完成得到的都是0,除非报错HTTP状态返回400、500之类的
作者:
dhh45
时间:
2010-4-15 12:00
哦,明白了,web_submit_form只管提交数据,只要提交成功就返回0,联想web_submit_date也是一样的道理,只是成功返回的值不一样
作者:
dhh45
时间:
2010-4-15 12:04
要达到登录成功日志显示登录成功,登录失败日志显示error,需要根据查找文本来判断了,这只是其中的一个思路,应该还有其他啊。顺便问一下,如何在日志中打印ii的值???
作者:
skyzhu
时间:
2010-4-15 13:27
lr_log_message("log %d",ii);
lr_log_message("log %s",lr_eval_string("{NewParam_1000}"));
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2