AutoIt vs. QTP

TIB發表於2010-01-16

有人比較了一下QTP和AutoIt:
http://www.autoitscript.com/forum/index.php?showtopic=66144


AutoIt and QTP are hard to compare but I 'll try since I just recently since about 4-6 weeks know AutoIT and QTP I know for about 2 years.

AutoIt的原本目的不是作為測試工具,但是確實具備自動化測試工具的主要組成部分。
AutoIT was not intended as a testing tool but definitely it has all components available to do automated testing but needs a little more studying.
If AutoIT recognizes your objects (not all are recognized with AU3Info tool but you can recognize more from script. HTML controls are not

recognized by AU3Info but can be controlled from functions as documented in IE.AU3 UDF library)

* QTP is more focused on the userlevel with a friendly userinterface also usable by non programmers. AutoIT is more for the script developer

and not for a tester although an experienced scripter can make life real friendly with GUI support which is contained within AutoIT language
QTP關注使用者層,擁有友好的使用者介面,即使不怎麼懂開發的人也能使用。AutoIt則偏向於由開發者使用(用的是類似VBScript的AutoIt語言)


* QTP has a better spy on windows/objects out of the box. If you scan this forum there are many short scripts which help you out to spy on

other objects. AutoIT can do it but its not fully integrated within AU3Info tool (the spy equivalant of QTP). So easy spying on internet controls is

not easy
QTP的Object Spy要比AutoIt的AU3Info強很多。

* QTP expertview is comparable to the development way how AutoIT works (Installing the full Scite Installation package you have a full IDE)
QTP的專家檢視用於指令碼編輯,而AutoIt用的是Scite。

* QTP has better support for terminal emulator out of the box although with AutoIT you can build easily your own screenscraper
QTP對於終端模擬器的支援要強些。

* QTP has java support which is not available thru AutoIt (So far not found .au3 scripts that connect with Java Native Interface / JNI)
QTP有java支援,但是AutoIt暫時還沒有找到連線JNI的.au3指令碼。

* QTP has powerbuilder object support which is not available thru AutoIt (unless you workaround this with virtual area's to click on)
QTP支援Powerbuilder,而AutoIt不支援。

* QTP has a translation table (control repository) to give objects a logical and a technical name. Within AutoIT you have to define this lookup

functionality yourself.
QTP有物件庫,AutoIt沒有。

* QTP has support for different browsers whereas AutoIT can only do this by Active Accessibility (search in forum) or bitmap comparison.

AutoIT supports IE controls by using IE.AU3 or own COM object references.
QTP支援IE和FF,AutoIt可以通過IE.au3或COM介面支援IE的操縱。


AutoIt的一些特色:
Autoit supports
* Easy screen snapshots
* Recognizes all basic windows controls
* Can recognize areas with pixelchecksum and pixelsearch (comparable with virtual objects of QTP)
* Has an advanced programming language with a lot of user defined functions
* Can be controlled from VBScript if wanted (Don't feel you should but at least you can)
* Within Scite IDE you can
** compile, build, run your scripts
** build a custom GUI for your scripts which is hard in QTP where you can only do this with an HTML page logic
** easily record simple scripts
** syntaxcoloring of your AU3 code
* You can create small standalone executables

Own experience so far
* Good support in the forums
* Good manual/help where a lot of examples are demonstrating how functions work
* Takes a litlle reading in the help before you have your basic scripts running (Windows controls and IE controls (study functions of IE.AU3))
* You need to know what you are doing. QTP brings you further at first steps but so far with QTP the userview is only for starters but quickly

you will change to expertmode for coding a better maintainable testsuite.
* Debugging loglines with consolewritecommand and run your script from within Scite as an IDE

Advice to read
* http://www.autoitscript.com/autoit3/docs/faq.htm
* http://www.autoitscript.com/forum/index.php?showtopic=37289
* Study the help file
* Check this forum

AutoIT has my vote over QTP for projects / applications where the controls are recognized properly.
WinRunner I used for about 4-5 years and AutoIT wins easily on the scripting language and functions. TSL is from ancient history compared

with AutoIT language but also here WinRunner has more support for different controls (Powerbuilder, Siebel, Java, If you don't need that

AutoIT will be a better start).

AutoIt是免費的,而QTP要花很多“銀子”
AutoIT is free where QTP cost(s) a lot of money, you should made the tradeoff if spending in the beginning a little more time on AutoIT will

save you money on the long run




下面是一個使用IE.au3的AutoIt指令碼,用於WEB測試自動化,例如開啟URL導航到指定頁面,點選頁面上的指定連結等:
#include <IE.au3>
$oIE = _IECreate ("http://blog.csdn.net/testing_is_believing/")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended

MsgBox(0, "Link Info", $iNumLinks & " links found")

For $oLink In $oLinks
   ;MsgBox(0, "Link Info", $oLink.href)
   If $oLink.href = "http://blog.csdn.net/Testing_is_believing/category/357781.aspx" Then
        $oLink.click
    ElseIf $oLink.href = "http://blog.csdn.net/Testing_is_believing/category/642324.aspx" Then
        $oLink.click
    EndIf
Next



其實,AutoIt和其他自動化測試工具 可以很好地整合在一起!

相關文章