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
  • 相关阅读:
    第11组 团队Git现场编程实战
    第11组 团队项目-需求分析报告
    团队项目-选题报告
    第二次结对编程作业
    第11组 团队展示
    第一次结对编程作业
    Nginx学习笔记
    Git学习笔记
    Qt学习笔记
    Eclipse中Outline里各种图标的含义
  • 原文地址:https://www.cnblogs.com/william126/p/8595713.html
Copyright © 2011-2022 走看看