股票切割线:QTP 读写外部Excel数据|QTP 资料-QTP技术论坛 - QTP技术论坛
来源:百度文库 编辑:九乡新闻网 时间:2024/05/06 09:47:30
'Read from Excel
Dim filepath,rowcount,i
filepath = pathfinder.Locate("C:\Users\Jevon\Desktop\TopView.xls") 'Excel path
DataTable.AddSheet("resultSheet") 'add new sheet to datatable
'import outside sheet data into new sheet in the datatable
DataTable.ImportSheet filepath,"Test_Summary","resultSheet"
rowcount = DataTable.GetSheet("resultSheet").GetRowCount
'define the pass count,passrateand all case count
Dim counts,passrate,bound
counts = 0
reDim arraydata(rowcount)
bound = rowcount-9
'the tenth row is the first test case result
For i = 10 to rowcount
Datatable.SetCurrentRow(i)
arraydata(i-10) =Datatable.Value("C","resultSheet") 'C is colume name
If arraydata(i-10) = "Pass" Then
counts=counts+1
End If
Next
passrate=counts/bound
'write into Excel
Dim rowcount1
rowcount1=DataTable.GetSheet("PassRate").GetRowCount 'define a new sheet named PassrRate
Dim row
row = rowcount1+1
DataTable.SetCurrentRow(row)
DataTable.Value("Name","PassRate") = "PassRate"
DataTable.Value("PassRate","PassRate") = passrate
'Write the second sheet of datatable into outside excel
DataTable.ExportSheet "C:\Users\Jevon\Desktop\TopView.xls",2
Dim filepath,rowcount,i
filepath = pathfinder.Locate("C:\Users\Jevon\Desktop\TopView.xls") 'Excel path
DataTable.AddSheet("resultSheet") 'add new sheet to datatable
'import outside sheet data into new sheet in the datatable
DataTable.ImportSheet filepath,"Test_Summary","resultSheet"
rowcount = DataTable.GetSheet("resultSheet").GetRowCount
'define the pass count,passrateand all case count
Dim counts,passrate,bound
counts = 0
reDim arraydata(rowcount)
bound = rowcount-9
'the tenth row is the first test case result
For i = 10 to rowcount
Datatable.SetCurrentRow(i)
arraydata(i-10) =Datatable.Value("C","resultSheet") 'C is colume name
If arraydata(i-10) = "Pass" Then
counts=counts+1
End If
Next
passrate=counts/bound
'write into Excel
Dim rowcount1
rowcount1=DataTable.GetSheet("PassRate").GetRowCount 'define a new sheet named PassrRate
Dim row
row = rowcount1+1
DataTable.SetCurrentRow(row)
DataTable.Value("Name","PassRate") = "PassRate"
DataTable.Value("PassRate","PassRate") = passrate
'Write the second sheet of datatable into outside excel
DataTable.ExportSheet "C:\Users\Jevon\Desktop\TopView.xls",2
QTP 读写外部Excel数据|QTP 资料-QTP技术论坛 - QTP技术论坛
qtp读取excel数据的另一个方法
qtp使用注意事项
QTP函数111
QTP编码小知识
QTP调用外部应用程序的4种方法 - [自动化测试]
QTP零散知识点总结1111
QTP多种函数使用方法222
QTP启用应用软件的方法
QC与QTP的连接
QTP描述性编程步步高
QTP的数据驱动方式—数据库和环境变量
谈一谈QTP中正则表达式的应用
QTP录制鼠标右键单击事件
QTP中DataTable操作大全 - (转)
QTP中设置共享对象库
[原创]?QTP?小技巧不断积累更新(拿来备忘)
Vbscript?正则表达式实例及在qtp中应用_
QTP中虚拟对象设置及应用实例_
QTP - 参数化LINK的方法汇总 - whoamiyaya的学习天地 - 51Test...
Excel动画教程:导入外部数据
[原创]彩电维修顺口溜[彩电维修资料网技术论坛]
Excel 在ExcelHome技术论坛的最佳学习方法 - 会员广场 - Excel Ho...
ARM论坛 - ARM技术论坛