|
最近在学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").Set DataTable("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 |
|