Dim username,password
Dim expectvalue,actualvalue
Dim currentcount,casecount
Dim i
systemutil.Run"C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"
datatable.ImportSheet"C:\Users\lcy\Desktop\1\testcase.xlsx",1,"Action1"
casecount=datatable.GetSheet("Action1").GetRowCount
For i = 1 To casecount
username =datatable.Value("username","Action1")
password =datatable.Value("password","Action1")
Dialog("Login").WinEdit("Agent Name:").Set username
Dialog("Login").WinEdit("Password:").Set password
Dialog("Login").WinButton("OK").Click
If dialog("Login").Dialog("Flight Reservations").Exist(3) Then
expectvalue=datatable.Value("expectvalue","Action1")
actualvalue=dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").GetROProperty("text")
If expectvalue= actualvalue Then
datatable.Value("actualvalue","Action1")=actualvalue
datatable.Value("status","Action1")="pass"
else
reporter.ReportEvent micFail,"登录提示信息","不正确"
datatable.Value("actualvalue","Action1")=actualvalue
datatable.Value("status","Action1")="fail"
End If
dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
else
If window("Flight Reservation").Exist(3) Then
currentcount=datatable.GetSheet("Action1").GetCurrentRow
If currentcount=casecount Then
reporter.ReportEvent micPass,"登录结果","登录成功"
datatable.Value("status","Action1")="pass"
else
reporter.ReportEvent micFail,"登录结果","输入错误的账号密码也能进入到登录后的页面"
End If
window("Flight Reservation").Close
else
reporter.ReportEvent micFail,"登录结果","点击确定按钮无反应"
End if
End If
datatable.GetSheet("Action1").SetNextRow
Next
转载于:https://www.cnblogs.com/aliceluo/p/5636513.html