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
  • 相关阅读:
    DirectFB、Layer、Window、Surface之间关系
    DirectFB的架构介绍
    Qt 学习之路 2(55):数据库操作
    MessageBox函数第一个参数hwnd的作用
    读取Properties文件以及中文乱码问题
    Maven项目读取resources下文件的路径问题(getClassLoader的作用)
    IDEA中Git更新合并代码后,本地修改丢失
    Cuba项目配置IDEA,如何dubug
    画删除线的方法,如何找替代方法,Deprecated注释
    Navicat的使用技巧
  • 原文地址:https://www.cnblogs.com/william126/p/8595713.html
Copyright © 2011-2022 走看看