datatable.ImportSheet "d:\mytestcase\test-fly-2.xls",1,"Action1" '从excel表里导入测试数据到datatable
Dim casecount '统计测试用例的数量
Dim casename '测试用例的输入账号
Dim casepassword '测试用例里的密码
Dim err_message '获取错误提示信息
casecount=datatable.GetSheet("Action1").GetRowCount
msgbox casecount
For i=1 to casecount step 1
casename=datatable("name","Action1") '从datatable里获取测试用例的name字段数据
casepassword=datatable("password","Action1") '从datatable里获取测试用例的name字段数据
Dialog("Login").WinEdit("Agent Name:").Set casename
wait(1)
Dialog("Login").WinEdit("Password:").Set casepassword
wait(1)
Dialog("Login").WinButton("OK").Click
If dialog("Login").Dialog("Flight Reservations").Exist(1) Then
err_message= dialog("Login").Dialog("Flight Reservations").Static("Incorrect password. Please").GetROProperty("text") '获得错误提示框运行时的text文本值
datatable("result","Action1")=err_message
dialog("Login").dialog("Flight Reservations").WinButton("确定").Click '关闭错误提示框
End If
' If window("Flight Reservation").Exist Then 思考正确的账号和密码如何处理
' datatable("result","Action1")="pass"
' End If
datatable.GetSheet("Action1").SetNextRow '让datatable指针下移,取下一行的测试数据
Next
datatable.ExportSheet "d:\mytestcase\test-fly-result.xls","Action1" '把测试结果回写excel表

