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

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

  • <strong id="5koa6"></strong>
  • 自動化測試工具TestComplete7亮相(2)

    發表于:2012-01-17來源:未知作者:娃娃點擊數: 標簽:自動化測試
    Call w.Keys(MyString [Enter]); ... 下一步就是獲取命令行應用程序的響應了,在TestComplete中可以通過wText來獲取,下面代碼展示了一個完整的小例子: Sub MyTest D

      Call w.Keys("MyString [Enter]");

      ...

      下一步就是獲取命令行應用程序的響應了,在TestComplete中可以通過wText來獲取,下面代碼展示了一個完整的小例子:

      Sub MyTest

      Dim p, w, txt, cnt, i, s

      Set p = Sys.Process("MyApp")

      Set w = p.Window("ConsoleWindowClass", "*")

      Call w.Keys("MyString [Enter]")

      ' 獲取命令行窗口的文本

      txt = w.wText

      ' 指定分割符

      aqString.ListSeparator = vbNewLine

      ' 獲取文本列表的長度

      cnt = aqString.GetListLength(txt)

      For i = 0 To cnt - 1

      ' 獲取一行文本的字符串

      s = aqString.GetListItem(txt, i)

      ' 把字符串寫入日志

      Call Log.Message(s)

      Next

      End Sub

      這種方式獲取的是所有文本,如果想以一種交互式的方式來測試命令行應用程序的話,還可以利用WScript.Shell,例如下面的代碼所示:

      Sub Main

      Dim WshShellObj, WshShellExecObj, out

      Set WshShellObj = CreateObject("WScript.Shell")

      Set WshShellExecObj = WshShellObj.Exec("cmd.exe")

      ' Flush the stream

      out = readTillChar(WshShellExecObj, ">")

      Log.Message(out)

      ' Send the "ver" command and the new line character

      WshShellExecObj.StdIn.Write("ver"+VbCrLf)

      out = readTillChar(WshShellExecObj, ">")

      Log.Message(out)

      End Sub

      Function readTillChar(WshShellExecObj, endChar)

      Dim out, curChar

      Do While Not WshShellExecObj.StdOut.AtEndOfStream

      curChar = WshShellExecObj.StdOut.Read(1)

      out = out + curChar

      If (curChar = endChar) Then

      readTillChar = out

      Exit Function

      End If

      Loop

      End Function

      GUI Explorer

      除了上面一些主要的改進和新特性外,TestComplete 7 還在很多細節的地方做了改進和提高,在Object Browser中,添加了一個GUI Explorer小工具,GUI Explorer可以幫助我們查看應用程序GUI界面控件的層次結構,例如,下圖展現的是Google主頁的GUI界面控件的層次結構:

      GUI Explorer可以讓我們觀察界面上的對象,不管它是可見的還是隱藏的。在GUI Explorer中,窗體控件被畫成亮灰色,非窗口控件則畫成暗灰色,不可見的控件都是白色的,對于隱藏的控件,則畫出其邊界。

      新加入了Table變量類型

      TestComplete7引入了一個新類型的變量 – Table,其實就是一個二維數組。

      Table可以在Project、Project Suites和Keyword test中使用。例如,下面的代碼展示了如何訪問Table中的數據:

      Sub getTableData

      columnCount = Project.Variables.Var1.ColumnCount

      rowCount = Project.Variables.Var1.RowCount

      For I=0 to rowCount-1

      For J=0 to columnCount-1

      Log.Message(Project.Variables.Var1.Item(J,I))

      Next

      Next

      End Sub

      小結

      TestComplete 7 的亮相給我們帶來不少驚喜,例如對關鍵字測試的支持(雖然還有待改進,但是畢竟邁出了第一步)、對PDA、RIA應用的支持等。

      此外,TestComplete一如既往地保持對新技術、工具、編譯器的及時支持,例如:IE8被及時地支持了,CodeGear RAD Studio 2009也被及時地支持了。在TestComplete 7 中,除了Microsoft 的Visual Studio Team System 和 AutomatedQA自己的 AQdevTeam外,現在還支持把bug錄到開源Bugzilla(看來金融危機下,開源的東西開始被重視起來了)。

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品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>