• qt测试脚本


     ' With Dialog("登录窗口")
    '   .WinEdit("用户名").Set DataTable("name", dtLocalSheet)
    '   .WinEdit("密码").SetSecure "48aaacb608d2ded49732d0cd2578c68ee5f42371"
    ''   .WinEdit("密码").Set DataTable("密码", dtLocalSheet)
    '   .WinButton("登录").Click
    ' End With
    '
    ' Set mywin = Dialog("登录窗口")
    ' mywin.WinEdit("用户名").Set "Mercury"
       
     Dim CountNum
     Dim n,p,Digmsg
     CountNum = DataTable.GetSheet("登录").GetRowCount

     For i=1 to CountNum
     ' 取出DataTable中的字段值:用户名、密码、用例名
      n = DataTable("用户名", dtLocalSheet)
      p =DataTable("密码", dtLocalSheet)
      caseName=DataTable("caseName",dtLocalSheet)
      
       Dialog("登录窗口").WinEdit("用户名").Set n
       Dialog("登录窗口").WinEdit("密码").Set p
       Dialog("登录窗口").WinButton("登录").Click
      
        If isDig Then
          Digmsg = ReturnDigMsg
          If  Digmsg =DataTable("预期结果", dtLocalSheet) Then
             QTP_Capture(caseName)
             CreateLog(Digmsg & " 与预期结果一致.")
             Dialog("登录窗口").Dialog("Flight Reservations").WinButton("确定").Click
    '         Dialog("登录窗口").Dialog("Flight Reservations").WinButton("text:=" & ok_text).Click
           DataTable.GetSheet("登录").SetNextRow   
           else
             Exit For
          End If
        End If
     Next

     Public function isDig()
        wait(2)
       isDig  = Dialog("登录窗口").Dialog("Flight Reservations").Exist(2)
     End Function

    '@Description 返回对话框文字 从Attached Text属性取值
     Public Function ReturnDigMsg()
      Dim MyWin
       Set  MyWin = dialog("登录窗口").Dialog("Flight Reservations")      
             ReturnDigMsg = MyWin.WinButton("text:=确定").GetROProperty("attached text")
    '    ReturnDigMsg = MyWin.WinButton("text:=" & ok_text).GetROProperty("attached text")
         End Function

    贴图:

         最终脚本:

     

    Dim userName
    Dim pwd
    Dim recordNum
    Dim strMsg
    Dim j


    Dialog("Select A System").AcxButton("OK").Click

    recordNum=DataTable.GetSheet("Action1").GetRowCount
    'msgBox "条数:" & recordNum  & "个"
    For i=0 to recordNum
     userName=DataTable("用户名",dtLocalSheet)
     pwd=DataTable("密码",dtLocalSheet)
    Dialog("User Login").WinEdit("User Name:").Set userName
    Dialog("User Login").WinEdit("User Name:").Type  micTab
    Dialog("User Login").WinEdit("Password:").Set pwd
    Dialog("User Login").WinEdit("Password:").Type  micTab
    Dialog("User Login").AcxButton("Login").Click
    'If   isDig Then
    strMsg=ReturnDigMsg
    If  strMsg=DataTable("预期结果",dtLocalSheet) Then  
      Dialog("User Login").Dialog("QOMO ARS").WinButton("确定").Click '''一次登陆
      DataTable.GetSheet("Action1").setNextRow
    Else
     Exit for
    'End if   end For
    'Next

    End If

    Next

    Public Function ReturnDigMsg()
      Dim MyWin
       Set  MyWin = dialog("User Login").Dialog("QOMO ARS")      
             ReturnDigMsg = MyWin.WinButton("确定").GetROProperty("attached text")
    '    ReturnDigMsg = MyWin.WinButton("text:=" & ok_text).GetROProperty("attached text")
         End Function

    'Public Function isDig()
       ' wait(2)
      ' isDig  = Dialog("Select A System").AcxButton("OK").Click)
     '  isDig=Dialog("Select A System").AcxButton("OK").Click
      ' End Function

    '很郁闷的事情是:竟然把循环的条件忘了。。导致一直在循环语句里面跳来跳去。造成不好的效果。。。狂晕。。。我太嫩了。。。

      

  • 相关阅读:
    codevs 1450 xth 的旅行
    Loj #6287 诗歌
    Codeforces 323C Two permutations
    Spoj MKTHNUM
    [TJOI2015]弦论
    Spoj SUBLEX
    bzoj 4338: BJOI2015 糖果
    bzoj 3462: DZY Loves Math II
    bzoj 2843: 极地旅行社
    清北学堂模拟赛d4t5 b
  • 原文地址:https://www.cnblogs.com/xianqingzh/p/1379486.html
Copyright © 2020-2023  润新知