UFT基础_参数化之datatable详解

UFT 14 参考手册,及理解基本的VBScript 语法,
https://admhelp.microfocus.com/uft/en/latest/UFT_Help/Subsystems/FunctionReference/Subsystems/OMRHelp/OMRHelp.htm#OV_Supp_Util/Overview.htm%3FTocPath%3DObject%2520Model%2520Reference%2520for%2520GUI%2520Testing%7C_____0

'first这列输入1  1 3 执行会执行3次,只有删除第三行才会执行两次或着设置只执行一次,方法:文件->设置->运行->数据表达式->只运行一次迭代
'msgbox datatable("first","Global")
'
'也会执行三次
'msgbox "aa"

'action1使用全局中的数据
'msgbox datatable("first",dtGlobalSheet)
'
'action1中使用本地中的数据
'msgbox datatable("bb",dtLocalSheet)
'
'action1中使用action2中的数据
'msgbox datatable("bb","Action2")
'
'globle中的数据
'msgbox datatable(1,1)

'action1中的数据
'msgbox datatable(1,2)

'action2中的数据
'msgbox datatable(1,3)

'action2中的数据第三列(C列)中的数据
'索引方法
'msgbox datatable(3,3)
'命明方法
'msgbox datatable("C","Action2")

'统计globalsheet中的行数
'msgbox datatable.GetRowCount


' 从一列中循环取值
'For i = 1 To datatable.GetRowCount Step 1
'   msgbox datatable("first",dtGlobalSheet)
'使当前行下移一行SetNextRow方法
'   datatable.SetNextRow
'   datatable.SetCurrentRow(i+1)
'Next
'
'赋值
'datatable.value("first","Global")="test"
'datatable.Value(1,2)= "test_02"
'

'导出当前Action中的数据到Action1.xls表中
''datatable.Export("D:\UFT\uft_11\Action1.xls")

'导入Action1.xls中数据到当前Action中
datatable.Import("D:\UFT\uft_11\Action1.xls")



'导出Gloabal,Action1,Action2中数据到data.xls中
datatable.ExportSheet "d:\data.xls","Global"
datatable.ExportSheet "d:\data.xls","Action1"
datatable.ExportSheet "d:\data.xls","Action2"

![Global中的数据](https://img-blog.csdn.net/20171116194753352?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdGpqaW5ncGFu/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)

'参数化登录功能

Wpfwindow("HPE MyFlight Sample Applicatio").WpfEdit("agentName").Set datatable("agentname",dtGlobalSheet)
Wpfwindow("HPE MyFlight Sample Applicatio").WpfEdit("password").Set datatable("password",dtGlobalSheet)
Wpfwindow("HPE MyFlight Sample Applicatio").WpfButton("OK").Click
'fromcity验证参数化
Set fromcity= Wpfwindow("HPE MyFlight Sample Applicatio").WpfComboBox("fromCity")
For i = 0 To fromcity.GetItemsCount -1
    If fromcity.Getitem(i)=datatable("fromcity",dtGlobalSheet) Then
'    print i&" is right"
   Reporter.ReportEvent 0 ,i,"is right"
else
'    print i&" is wrong"
   Reporter.ReportEvent 1,i,"is wrong "
End If

datatable.SetNextRow

Next

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值