zoukankan      html  css  js  c++  java
  • UFT测试本地应用程序登陆小实例(描述性编程)

    Dim username,password
    Dim casecount,i
    Dim currentid
    
    DataTable.ImportSheet "C:UsersjohnDesktopwilliam.xlsx",1,"Action1"
    casecount=datatable.Getsheet("Action1").GetRowCount
    
    For i = 1 To casecount
        username=DataTable("username","Action1")
        password=DataTable("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(3) Then
            ex=DataTable("ex","Action1")
            ac=Dialog("Login").Dialog("Flight Reservations").Static("Please enter agent name").GetROProperty("text")
            If ex=ac Then
                DataTable("test","Action1")="PASS"
            else
                DataTable("test","Action1")="Fail"
                DataTable("acresult","Action1")=ac
            End If
            if Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Exist(5) Then
                Dialog("Login").Dialog("Flight Reservations").WinButton("确定").Click
            End if
        elseif Dialog("Flight Reservations").WinButton("确定").Exist(10) Then
            Dialog("Flight Reservations").WinButton("确定").Click
            msgbox "test"    
            If window("Flight Reservation").Exist(3) Then
                currentid=dataTable.GetSheet("Action1").GetCurrentRow
                window("Flight Reservation").Close
                If currentid=casecount Then
                    dataTable("test","Action1")="PASS"
                else
                    reporter.ReportEvent micFail,"Flight","wrong user and password"
                End If
            else
                reporter.ReportEvent micFail,"Flight","No response"
            End If    
        End If
        DataTable.GetSheet("Action1").SetNextRow
    Next
    DataTable.Export "C:UsersjohnDesktopwilliam.xlsx"
    'Window("Flight Reservation").Close
    
    'Dim casecount
    '
    'DataTable.ImportSheet "C:UsersjohnDesktopwilliam.xlsx",1,"Action1"
    'casecount=datatable.Getsheet("Action1").GetRowCount
    'msgbox "123 "&casecount&"   dddd"
    
    
    'Dialog("Login").WinButton("Cancel").Click
  • 相关阅读:
    eval函数欺负我
    JS Compress and Decompress
    PowerDesigner 把Comment写到name中 和把name写到Comment中 pd7以后版本可用
    vue + axios 通过Blob 转换excel文件流 下载乱码问题
    poj 3687Labeling Balls
    poj 2485Highways
    poj 1258AgriNet
    poj 3041Asteroids
    poj 1035Spell checker
    poj 3020Antenna Placement
  • 原文地址:https://www.cnblogs.com/william126/p/8595713.html
Copyright © 2011-2022 走看看