用QTP测试:登录脚本求助!!!
最近在学QTP,测试一个登录功能:先录制登录,然后设计了一个登录用例,放在本地xls表单中。定义变量,把用户名密码参数化。。。。。。附脚本和测试结果,哪位大侠能帮帮小女子~。~?万分感谢了!!!
Dim outputvalue
Dim istatus
Dim i
For i=1 to datatable.GetSheet("登录订票网站").GetRowCount
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").SetDataTable("name",dtLocalSheet)
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure DataTable("pwd",dtLocalSheet)
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Object CheckPoint("Welcome: Mercury Tours")
outputvalue=DataTable("outmsg",dtLocalSheet)
istatus=DataTable("tatus",dtLocalSheet)
If outputvalue<>istatus Then reporter.ReportEvent 1,"登录测试","期望值:"+istatus+"实际输出值:"+outputvalue
else reporter.ReportEvent 0,"登录测试","OK"
End If
DataTable.GetSheet("Login").SetNextRow
Next :Q 真郁闷。。。谁帮帮我~~ :'( :'( :'( :'( SetSecure 换成 set
ifxxxthen 后面换行
else 后面换行
建议
建议先把if.....else去掉找找原因,应该没有大问题!回复 5# 的帖子
哎。。。then else本来是换行写的,结果说我脚本里缺少then。。。。。。。。。。 If outputvalue<>istatus Then reporter.ReportEvent 1,"登录测试","期望值:"+istatus+"实际输出值:"+outputvalueelse reporter.ReportEvent 0,"登录测试","OK"
End If
改为
If outputvalue<>istatus Then
reporter.ReportEvent 1,"登录测试","期望值:"+istatus+"实际输出值:"+outputvalue
else reporter.ReportEvent 0,"登录测试","OK"
End If
试试 If outputvalue<>istatus Then
reporter.ReportEvent 1,"登录测试","期望值:"+istatus+"实际输出值:"+outputvalue
else
reporter.ReportEvent 0,"登录测试","OK"
End If
页:
[1]