qtp飞机订票系统软件测试代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Mainaction

Dim id

Dim Mima

Dim dingpiaoriqi

Dim chuanzhen

Dim chaxun

Dim chaxunhaoma

Dim update

Dim detele

Dim j

Dim m

Dim s

Datatable.ImportSheet "C:\Xswl\suchang\Desktop\excel\Main.xls","Sheet1","Main"

'创建ExcelApp对象

Set ExcelApp=CreateObject("Excel.Application")

'打开excel

Set ExcelWor=ExcelApp.Workbooks.Open("C:\Xswl\suchang\Desktop\excel\Main.xls")

'这里需要用到UsedRange,表示Sheet1所使用单元格的范围,否则会将所有单元格都打印出

Set ExcelShe=ExcelWor.Worksheets("Sheet1").UsedRange

'计算使用的单元格行数

rowcount=ExcelShe.Rows.count

'计算使用的单元格的列数

columncount=ExcelShe.Columns.count

For i=1 to rowcount

j =1

AgentName = ExcelShe.Cells(i,j)

j = j+1

Mimaword = ExcelShe.Cells(i,j)

j = j+1

DateOfFlight = ExcelShe.Cells(i,j)

j = j+1

FaxNumber = ExcelShe.Cells(i,j)

j = j+1

SearchTest = ExcelShe.Cells(i,j)

j = j+1

DateOfUpdate = ExcelShe.Cells(i,j)

j = j+1

DeleteName = ExcelShe.Cells(i,j)

m = 0

'调用登录Action

SystemUtil.run "C:\Program Files (x86)\HP\QuickTest

Professional\samples\flight\app\flight4a.exe"

RunAction "Login", oneIteration, AgentName, Mimaword

s = DataTable.Value("Login","Global")

If s = "1" Then RunAction "Book", oneIteration, DateOfFlight else m = 1 End If s = DataTable.Value("Book","Global")

If s = "1" Then RunAction "Fax", oneIteration, FaxNumber End If

s = DataTable.Value("Fax","Global")

If s = "1" Then RunAction "Search", oneIteration, SearchTest, i End If

s = DataTable.Value("Search","Global")

If s = "1" Then RunAction "Update", oneIteration, DateOfUpdate End If

s = DataTable.Value("Update","Global")

If s = "1" Then RunAction "Delete", oneIteration,DeleteName End If

If m =0 Then Window("Flight Reservation").WinMenu("Menu").Select "File;Exit" End If

Next

Set ExcelShe=Nothing

'关闭工作簿对象

ExcelWor.Close

'退出ExcelApp对象

ExcelApp.Quit

Loginaction

Dim id

Dim mima

Datatable.ImportSheet "C:\Xswl\suchang\Desktop\excel\Login.xls","Sheet1","Login"

'创建ExcelApp对象

Set ExcelApp=CreateObject("Excel.Application")

'打开excel文件工作簿

Set ExcelWor=ExcelApp.Workbooks.Open("C:\Xswl\suchang\Desktop\excel\Login.xls")

'这里需要用到UsedRange,表示Sheet1所使用单元格的范围,否则会将所有单元格都打印出

Set ExcelShe=ExcelWor.Worksheets("Sheet1").UsedRange

'计算使用的单元格行数

rowcount=ExcelShe.Rows.count

'计算使用的单元格的列数

columncount=ExcelShe.Columns.count

For i=1 to rowcount

For j=1 to columncount

'获取单元格的内容

If j=1 Then AgentName =ExcelShe.Cells(i,j) Else Mimaword = ExcelShe.Cells(i,j) End If

Next

相关文档
最新文档