21天QTP突破(第五天)
上一篇 / 下一篇 2011-03-31 21:31:01 / 个人分类:QTP
OK,又加班有点晚了,但是学习还是不能停下来,呵呵,我们继续~~
k/fq3{[1{[$R8K051Testing软件测试网2T![\p:J P u今天我们主要看看QTP的检查点!51Testing软件测试网`;g#{*]s3W;y(He~6B
51Testing软件测试网"j^'f+R~G ^iQuickTest Professional 提供以下的檢查點:51Testing软件测试网-e ceTM'?:F)D
/`s%@l*[ ~]3a0檢查點類型 說明 範例 51Testing软件测试网$tgYvJ*eq
標準檢查點 檢查物件的屬性 檢查某個 radio button 被選取 51Testing软件测试网)ui&D,n;Nm
圖片檢查點 檢查圖片的屬性 檢查圖片的來源檔是正確的
BH
H@9B0CU0表格檢查點 檢查表格的內容 檢查表格內的欄位內容是正確的
)Df7g/gFfC0網頁檢查點 檢查網頁的屬性 檢查網頁載入的時間或是網頁是否含有不正確的連結 (link) 51Testing软件测试网lNv/p2NPvo{b8rP
文字 / 文字區域檢查點 檢查網頁上或是視窗上該出現的文字是否正確 檢查訂票後是否正確出現訂票成功的文字 51Testing软件测试网?JR7R%W@/UE
圖像檢查點 擷取網頁或視窗的畫面檢查畫面是否正確 檢查網頁 (或是網頁的某一部份) 是否如預期的呈現
0{vL]N%@0資料庫檢查點 檢查資料庫的內容是否正確 檢查資料庫查詢的值是否正確
!wx*qf*?(B"D7|0XML 檢查點 檢查 XML 文件的內容 注意:XML 檔案檢查點是用來檢查特定的 XML 檔案; XML 應用程式檢查點則是用來檢查網頁內所使用的 XML 文件。
注意: When QuickTest creates a checkpoint, it assigns a name based on information inside the checkpoint—the checked value, for example. The checkpoint name remains unchanged, even if you subsequently modify the information on which it was based. Keep this in mind when looking for checkpoints displayed in the Tree View. However, note that QuickTest may shorten the name displayed in the Tree View.51Testing软件测试网y.j f'Q0SqPnY
51Testing软件测试网 B0S3_;O ~BBk首先我们再重新录制一个脚本,新的,最好重新执行检查一下脚本是不是可以跑得起来,然后将脚本命名checkp[oint,呵呵,这个就是我们的检查点测试脚本,我的脚本如下:
_,g K"L'S6Ty*zM01v%N%j;I(l(j u^ZN0Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "MERCURY"51Testing软件测试网Y Ug4g-o
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("password").SetSecure "4d9484f18b3da8c9cfdc23c13e4d85c72de5f942"51Testing软件测试网mo(Ub$Zs-p
Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").Image("Sign-In").Click 30,9
;t[o m"V DbLP0Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("servClass").Select "First"
NO)Hk5\wW*I-ONsG"T0Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 43,9
kh4?:Ql2KQnC o-C0Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("outFlight").Select "Blue Skies Airlines$361$271$7:10"51Testing软件测试网'K%?d_
[!e#fL
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("inFlight").Select "Blue Skies Airlines$631$273$14:30"
.o"F"v/m2SYRLQ0Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 49,651Testing软件测试网`"T1]N2c'ZCSw
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Set "jason"
z
m;TW#{O^r5r0Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passLast0").Set "zx"51Testing软件测试网8ueC-cf,ok5{
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").Image("buyFlights").Click 43,851Testing软件测试网-~"hsmH
HD
Browser("Welcome: Mercury Tours").Page("Flight Confirmation: Mercury").Image("Logout").Click51Testing软件测试网Y0m3cZ1G9{vmU
F8{
Browser("Welcome: Mercury Tours").Page("Sign-on: Mercury Tours").Sync51Testing软件测试网RY!y:W+P|?!T ?"k
Browser("Welcome: Mercury Tours").Close51Testing软件测试网EkOG&Op
q4gyj+nDZ(|0这是原始的脚本,最后我们在对比一下改造后的脚本会是什么摸样!呵呵
2sPv2Uu(c%h0-zo9y+GQDpL0由于涉及后面插入测试点的方式问题,所以最好大家还是调出 Active Screen,方法是點選工具列上的 Active Screen 按鈕,或是點選 View -> Active Screen 51Testing软件测试网@"ypH/N'r8e
51Testing软件测试网5M ZRR.q+Mw你想要在使用者輸入姓氏後,建立一個檢查點檢查 First Name edit box 的屬性。51Testing软件测试网I%g(^,Z_'n5H;g M?
51Testing软件测试网.cQ6J&kp+Z7An在 test tree 中,展開 (+) Action1 -> "Welcome: Mercury" -> "Book a Flight"。51Testing软件测试网-o(TK&OIgZ
51Testing软件测试网#t8ik'`~由於輸入使用者姓氏的測試步驟是 "passFirst0" Set... 這個步驟,所以你要選取 "passFirst0" Set... 下面的測試步驟以便建立檢查點。51Testing软件测试网a5Wi~(dw6JxD
51Testing软件测试网_ S5@U%W&_,b*M選取這個測試步驟後,在 Active screen 會顯示 Book a Flight 網頁,而且被選取的物件也會被框起來。你也可以看到旅客的姓氏出現在 First Name edit box 中。
qo _#[&M:AA09e`G
r,ld4Y*J0對 Active Screen 中的 First Name edit box 點選滑鼠右鍵,選取 Insert Standard Checkpoint。開啟 Object Selection – Checkpoint Properties 對話視窗。
V3Ifjo051Testing软件测试网Q1j"N"|!W\Cr
確認 WebEdit: passFirst0 被選取後,點選 OK。
/_X8w+c*{ U0E)PfkBW!n{0開啟 Checkpoint Properties 對話視窗。51Testing软件测试网 uxF0X.^
51Testing软件测试网'K#w C+dai#~!Kj
tW)dpBnh/czsw1E0對話視窗會顯示物件的屬性:
1T.Gf(r:U+^y0Logical name 是這個物件的名稱 Class 是這個物件的類別。 WebEdit 表示這個物件是個 edit box。 在 Type 欄位中的 ABC 圖示表示這個屬性的值是個常數。#d3K$U2cJ0對每個物件, QuickTest 會使用預設的屬性作為檢查的屬性。以下說明這些預設的屬性:51Testing软件测试网\ez_'?*^g
\d7\YQ
u.p0屬性 值 說明
Y's"NYrz2ZXA0html tag INPUT INPUT 就是 HTML 原始碼中的INPUT 標籤。
}Vm#j
LMxS0innertext 在這個範例中,innertext 的值是空的。檢查點會檢查執行時這個屬性值是不是空的。
`Blv%\0name passFirst0 passFirst0 這個 edit box 的名稱。