登录模块的增强脚本

Dim username,password

Dim expectvalue,actualvalue

Dim currentcount,casecount

Dim i

systemutil.Run"C:\Program Files (x86)\HP\Unified Functional Testing\samples\flight\app\flight4a.exe"

datatable.ImportSheet"C:\Users\lcy\Desktop\1\testcase.xlsx",1,"Action1"

casecount=datatable.GetSheet("Action1").GetRowCount

For i To casecount  

    username =datatable.Value("username","Action1")

    password =datatable.Value("password","Action1")

    Dialog("Login").WinEdit("Agent Name:").Set username

    Dialog("Login").WinEdit("Password:").Set password

    Dialog("Login").WinButton("OK").Click

    If dialog("Login").Dialog("Flight Reservations").Exist(3Then

        expectvalue=datatable.Value("expectvalue","Action1")

        actualvalue=dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").GetROProperty("text")

        If expectvalue= actualvalue Then

            datatable.Value("actualvalue","Action1")=actualvalue

            datatable.Value("status","Action1")="pass"

        else

            reporter.ReportEvent micFail,"登录提示信息","不正确"

            datatable.Value("actualvalue","Action1")=actualvalue

            datatable.Value("status","Action1")="fail"

        End If

        dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click

    else

        If window("Flight Reservation").Exist(3Then

            currentcount=datatable.GetSheet("Action1").GetCurrentRow

            If currentcount=casecount Then

                reporter.ReportEvent micPass,"登录结果","登录成功"

                datatable.Value("status","Action1")="pass"

            else

                reporter.ReportEvent micFail,"登录结果","输入错误的账号密码也能进入到登录后的页面"

            End If

            window("Flight Reservation").Close

        else

            reporter.ReportEvent micFail,"登录结果","点击确定按钮无反应"

        End if

    End If

    datatable.GetSheet("Action1").SetNextRow

Next

转载于:https://www.cnblogs.com/aliceluo/p/5636513.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值