• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    robot函數實例講解(一)

    發布: 2008-7-24 17:59 | 作者: 網絡轉載 | 來源: 51testing sincky | 查看: 74次 | 進入軟件測試論壇討論

    領測軟件測試網

    功能說明:出現一個提示對話框,N秒后消失,比如說:提示等待一個窗口阿,有時候這個窗口沒了,我也不知道腳本運行到什么地方了,提示一下挺好,也方便其他的測試員修改,而且,也不影響無人值守的操作

    例子:SQAMsgbox "test","title",5

    Global iTime as Integer

    Declare Function TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer

    Declare Function SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer


    Function TimedDlgFunc(id As String, Action As Integer, Suppvalue As Long) As Integer
        Static StartTime
        Dim EndTime
        Dim vTimeoutvalue as Variant

        Select Case Action
            Case 1      'Dialog box Initialization
                    StartTime = Timer

                    If StartTime + iTime >= 86400 Then
                            StartTime = 86400 - StartTime - iTime
                    End If
                    TimedDlgFunc = 1

            Case 2      'Button pushed or any control changed (except typing in text or combo box)
                Select Case Suppvalue
                    Case 1
                        DlgEnd -1
                    Case 2
                        DlgEnd 0
                    Case Else
                        TimedDlgFunc = 0
                End Select

            Case 3      'Change in text or combo box contents
                    TimedDlgFunc = 1

            Case 4      'Change of control focus
                    TimedDlgFunc = 1

            Case 5      'Idle state (return 0 to prevent this being continually called)
                    EndTime = Timer
                    If (EndTime - StartTime) >= iTime Then
                            DlgEnd -1
                    End If
                    vTimeoutvalue = Format(iTime - (EndTime - StartTime), "#.#")
                    DlgText DlgControlID("txtTimevalue"), CStr(vTimeoutvalue)
                    TimedDlgFunc = 1
        End Select

    End Function


    Function SQAMsgBox(sMsgText as String, Optional vMsgCaption as Variant, Optional vTimeOut as Variant) as Integer
        Dim Result as Integer
        Dim TotalTime As Integer
        Dim sCmdText as String   
        Dim sTimeoutText as String
        Dim vvalue as Variant

       
        If IsMissing(vMsgCaption) Then
            vMsgCaption = "SQAMsgBox"
        End If
        If IsMissing(vTimeOut) Then
            vTimeOut = 20       'seconds
        End If

        sTimeoutText = "Timeout: "
       
    '-----
        Begin Dialog dlgMsgBox 200, 80, vMsgCaption, .TimedDlgFunc
            GroupBox 5, 2, 190, 40, "", .grpMsgTxt
            Text 15, 11, 175, 25, sMsgText, .txtMsgText
            Text 15, 47, 180, 20, sCmdText, .txtCmdText
    '--------------
            Button 20, 60, 40, 14, "&OK", .btnOK
            Button 140, 60, 40, 14, "&Cancel", .btnCancel
            Text 78, 63, 30, 10, sTimeoutText, .txtTimeText
            Text 108, 63, 20, 10, vTimeout, .txtTimevalue
        End Dialog
    '-----

        Dim TimedDlg As dlgMsgBox
        iTime = CInt(vTimeOut)
        Result = Dialog(TimedDlg)
       
        If Result = 2 Then
            SQAMsgBox = sqaFail
        Else
            SQAMsgBox = sqaPass
        End If   
       
    End Function

    關于Recognition
    一共分為Recognition, ParentRecognition, FullRecognition
    1. To find the recognition method of the currently active window:
    Result=SQAGetProperty(".\","Recognition",value)
    Returned value:
    Type=Window;Name=frmMain
    抓出來的是當前窗口的一些信息

    2. To find the immediate parent of the tree view item Bach:
    Result=SQAGetProperty("Name=treMain;\;ItemText=Bach","ParentRecognition",value)
    Returned value:
    Type=TreeView;Name=treMain
    抓出來的是樹型結構的父結點的信息

    3. To find the complete object path of the tree view item Bach, beginning with the desktop and ending with the target object itself:
    Result=SQAGetProperty("Name=treMain;\;ItemText=Bach","FullRecognition",value)
    Returned value:
    Type=Window;Name=frmMain;\;Type=TreeView;Name=treMain;\;Type=TVItem;ItemText=Bach
    抓出來的是樹型結構中指向該控件的全部路徑

    Rational Robot中自動進行100次操作
    Rational Robot中的SQA Basic與Basic語言極為類似,下面是一個for循環的例子,其中cstri()函數把整數轉換成字符串。
    Sub Main
        Dim Result As Integer
        Dim i As Integer
        ……
      
         'begin of for loop
         for i=1 to 100 step 1
         ……
         InputKeys cstr(i*3) '這個地方設置輸入值為I*3.
         ……
        next
        'end of for loop
        ……
    End Sub

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/

    TAG: robot Robot String 函數 講解 實例

    31/3123>

    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>