空间可以多维存在,测试也可以,所谓的测试经验,只不过是测试思维的一部分而已...

21天QTP突破(第五天)

上一篇 / 下一篇  2011-03-31 21:31:01 / 个人分类:QTP

51Testing软件测试网 z&SV];EVO;H

OK,又加班有点晚了,但是学习还是不能停下来,呵呵,我们继续~~

k/fq3{[1{[$R8K051Testing软件测试网2T![\p:JP u

今天我们主要看看QTP的检查点!51Testing软件测试网`;g#{*]s3W;y(He~6B

51Testing软件测试网"j^'f+R~G ^i

QuickTest 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 文件。 

3UG&Fl2TeSyX?051Testing软件测试网E a7G&N Wxx;w

注意: 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.jf'Q0SqPnY

51Testing软件测试网 B0S3_;O ~BBk

首先我们再重新录制一个脚本,新的,最好重新执行检查一下脚本是不是可以跑得起来,然后将脚本命名checkp[oint,呵呵,这个就是我们的检查点测试脚本,我的脚本如下:

_,g K"L'S6Ty*zM0

1v%N%j;I(l(j u^ZN0Browser("Welcome: Mercury Tours").Page("Welcome: Mercury Tours").WebEdit("userName").Set "MERCURY"51Testing软件测试网YUg4g-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[om"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?:Ql2KQnCo-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/m2SY RLQ0Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 49,651Testing软件测试网`"T1]N2c'ZCS w
Browser("Welcome: Mercury Tours").Page("Book a Flight: Mercury").WebEdit("passFirst0").Set "jason"
z m;T W#{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软件测试网5MZRR.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(T K&OIgZ

51Testing软件测试网#t8i k'`~

由於輸入使用者姓氏的測試步驟是 "passFirst0" Set... 這個步驟,所以你要選取 "passFirst0" Set... 下面的測試步驟以便建立檢查點。51Testing软件测试网a5Wi~(dw6JxD

51Testing软件测试网_ S5@U%W&_,b*M

選取這個測試步驟後,在 Active screen 會顯示 Book a Flight 網頁,而且被選取的物件也會被框起來。你也可以看到旅客的姓氏出現在 First Name edit box 中。

qo _#[&M:AA0

9e`G r,ld4Y*J0對 Active Screen 中的 First Name edit box 點選滑鼠右鍵,選取 Insert Standard Checkpoint。開啟 Object Selection – Checkpoint Properties 對話視窗。
V3Ifjo051Testing软件测试网Q1j"N"|!W\Cr

51Testing软件测试网/s'v,[OxT

確認 WebEdit: passFirst0 被選取後,點選 OK。

/_ X8w+c*{ U0

E)PfkBW!n{0開啟 Checkpoint Properties 對話視窗。51Testing软件测试网 uxF0X.^
51Testing软件测试网'K#w C+d ai#~!Kj

tW)dp Bnh/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"N Yrz2ZXA0html tag        INPUT           INPUT 就是 HTML 原始碼中的INPUT 標籤。 
}Vm#j LMxS0innertext                       在這個範例中,innertext 的值是空的。檢查點會檢查執行時這個屬性值是不是空的。 
` Blv%\0name            passFirst0      passFirst0 這個 edit box 的名稱。 
w jM`&|8[Ur0type            text            text 是 HTML 原始碼中這個 INPUT 物件的類型。 51Testing软件测试网.i7w6p5|2Abh
value  <姓氏> (錄製測試腳本時你輸入的姓氏)  在這個 edit box 輸入的文字。 

S+TGq7f'?051Testing软件测试网hY,c+?7e

接受預設的設定值,然後點選 OK。QuickTest 會在你選取的步驟之前建立一個標準的檢查點。
aBK$iM3C&q;f051Testing软件测试网(R_b9VKc f

儲存測試腳本51Testing软件测试网(|uy |DaP]6f

點選 File -> Save 或是點選工具列上的 Save按鈕。

x1{A/J,c` {}051Testing软件测试网vI/bV(p*HO

接下來你會按照以上的步驟建立其它類型的檢查點。51Testing软件测试网zT&[ e4m

Z"G8o's9D;zga{0好了,至此我们的检查点已经建立完成,我们运行一下刚保存的脚本看看!!51Testing软件测试网9BusN\4B

51Testing软件测试网/f.JS3|y'z,o4O

运行之后我们就会发现,执行结果中之前没有插入检查点显示为 DONE,现在显示为PASS,数目为151Testing软件测试网?;dX/r icHbk

&L m b3e&R0大家可以多插入一点检查点熟悉一下各个检查点的属性,了解一下检查点的内容~~51Testing软件测试网urrI F|@


TAG:

 

评分:0

我来说两句

Open Toolbar