您的位置:首页 > 其它

UFT中应用

2015-10-18 14:08 197 查看
在UFT中飞机订票系统中用split方法计算总价格:

Dim price,price1,tickets,total,total1,a,b

price=window("Flight Reservation").WinEdit("price:").GetROProperty("text")

price1=split(price,"$")

msgbox price1(1)

a=CDBL(price1(1))

tickets=window("Flight Reservation").WinEdit("tickets:").GetROProperty("text")

msgbox tickets

total=window("Flight Reservation").WinEdit("total:").GetROProperty("text")

total1=split(total,"$")

msgbox total1(1)

b=CDBL(total1(1))

If tickets*a=b Then

reporter.ReportEvent micPass,"结果","正确"

else

reporter.ReportEvent micFail,"结果","错误"

End If

在UFT中飞机订票系统中用right方法计算总价格:

Dim price,price1,tickets,total,total1,a,b

price=window("Flight Reservation").WinEdit("price:").GetROProperty("text")

a=len(price)

p=right(price,a-1)

msgbox p

tickets=window("Flight Reservation").WinEdit("tickets:").GetROProperty("text")

msgbox tickets

total=window("Flight Reservation").WinEdit("total:").GetROProperty("text")

b=len(total)

s=right(total,b-1)

msgbox s

If tickets*p=s Then

reporter.ReportEvent micPass,"结果","正确"

else

reporter.ReportEvent micFail,"结果","错误"

End If
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: