不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

Datapool实际应用

上一篇 / 下一篇  2006-12-06 20:33:58 / 个人分类:软件测试技术

51Testing软件测试网rN&dN L0? W

                            实际应用51Testing软件测试网(zu~~Q/c\8f8W%B

6A3aeh4\b-C0   51Testing软件测试网5x{/`b ] Y

:X7h/T.Ny0W0

[G$[)SYz3V J4i0   现有软件系统的登陆功能进行测试。测试工程师设计测试用例,在实际工作中发现登陆系统版本基本稳定,而且功能孤立,界面在将来的版本中变化的可能性不大,所以决定测试自动化,减少人工重复劳动,提高测试效率。

*c9~WW3eu0

#{ o;{"Ng'Uj,g0    测试工程师开始利用黑盒测试方法等价类法,因果分析法,边界值法等方法设计测试用例,开发功能测试脚本,用datapool(数据池中的数据是设计 测试用例的时候用到的输入值)保存测试数据。 登陆界面需要输入用户名,密码,在数据池中建立两个字段username,passwordDatapool中的数据和测试用例中输入数据相一致。

1NY8Kf9x5pa@"D051Testing软件测试网Q'|!Z7}#A

第一步:创建名字为dpdatapool,假如字段name,password并自动生成数据,然后把测试用例中各种数据输入dp

U6H@Q1} h!f051Testing软件测试网%l v0SX;uJPn

第二步:录制功能测试脚本,脚本如下:

B1gB#B:a0PDi7o051Testing软件测试网*bCB*W s2` _

Sub Main51Testing软件测试网7m/o2YJ"|h6`

51Testing软件测试网X'[5Z-F3Zq

    Dim Result As Integer51Testing软件测试网G/^8|lN

51Testing软件测试网 O7NF(@H#M WxC1y

 51Testing软件测试网K/K0_%w }*](j

51Testing软件测试网r g)l ?"\r2w&beK

    'Initially Recorded: 2004-4-24  10:59:2451Testing软件测试网:X9E:` UO,a:R

.N O:Yvz]vX_ j0    'scrīpt Name: Five51Testing软件测试网q+{&myf'@8nj~

51Testing软件测试网8sA.R(Th

    StartApplication "xxx"

9]0`I2Xa_r4z051Testing软件测试网-AI6tT/d%X#^n

    51Testing软件测试网sKs Z{@K s:S

~2}cg&E-C0    Window SetContext, "Caption=登陆", ""

X7S%Z4{r$R3@Rt6w0

hc1w+\)}nVP:n6B0    InputKeys "sa"

:ow.DRVS/FpT0

7uDf#?/O1A5fJ-j0    EditBox Click, "ObjectIndex=1", "Coords=34,9"

(Y*Y sIA0

v/u4L.~]6J%y,r0    InputKeys "sa"

,g.t,sm%e2Bu051Testing软件测试网'BF W3v:mI5o

    PushButton Click, "Text=登陆"51Testing软件测试网-Z~!JU3XY+d0@

1aNnWpXCW0   

"s|ES.p5A051Testing软件测试网4p|X^Xb%b;S P

    Window SetContext, "Caption=登陆;Class=#32770", ""

({#v)LICa051Testing软件测试网7PdCU%o!gy,R

    PushButton Click, "Text=确定" 51Testing软件测试网)CyXY7~2Dd$U

tic Uus&E0End Sub

'p6rZ4C7K_%e0G051Testing软件测试网 s-p;[M"T

 第三步:循环读出datapool数据,进行自动化测试,脚本如下

5f'I#AB k%V3m051Testing软件测试网w_#Q'PK}2~'M{

 '$Include "sqautil.sbh"

:AYO-V9AAUa c0

g|t!V+z t ?'\0 Sub Main

r!OI)L9D5|,A;N051Testing软件测试网*k?MO R,lbX

    Dim Result As Integer

U-G2W ptFt IE.y!n051Testing软件测试网*o0IF-i'{A

    Dim dp_id as Long51Testing软件测试网 f#w`(j8o!GE

51Testing软件测试网-Y"?-xw'e!XxO$x

    Dim dp_Result as Long

ap_3Mz:I o ~051Testing软件测试网 ~[ \$A^.y[\^H

   Dim strName as String

,R3W-C z^W051Testing软件测试网7qg$Rc2sZp ~

    Dim strPassWord as String51Testing软件测试网+C-J j0xOY,C$^

51Testing软件测试网K9|@/BnJv;j

  'Initially Recorded: 2004-4-24  10:30:51

i(L+P/h"R6tF0

1z/}5^M)a0    'scrīpt Name: Four

Y K7_5] D6jtP051Testing软件测试网kB#e;swy]8\

 

V|V(DgR0

'~ `7g:gD.?U]0    StartApplication "xxx"51Testing软件测试网a+{.XTVWv ~

$v1pPVE0    Window SetContext, "Caption=登陆", ""

,` r2wp|0x/R S051Testing软件测试网V$c4K ja1w1Ya

    dp_id = SQADatapoolOpen ("dp", FALSE, SQA_DP_SEQUENTIAL, FALSE)

/Y7_/Ffmou M0

R"n)C BtB/m,z0   dp_Result = SQADatapoolFetch (dp_id)51Testing软件测试网-N'SH}Tei

51Testing软件测试网)b,eEC.u`

   while dp_Result <>  sqaDpEOF

Y _@(lA M$qW0

a\?+j+~0          dp_Result = SQADatapoolValue (dp_id, "name", strName)51Testing软件测试网O[(u b$Q/F/Jb.R

h? `!O"G0           dp_Result = SQADatapoolValue (dp_id, "password", strPassWord)

P"k-`%c!k!pau&F8~051Testing软件测试网/`$CCDg/okN&q:X

           dp_Result = SQADatapoolFetch (dp_id)51Testing软件测试网-a;d3~_8b

51Testing软件测试网'gB W?6N0? o

           InputKeys strName

-a7UB.|-J051Testing软件测试网5} YMV&[2?-o

           EditBox Click, "ObjectIndex=1", "Coords=34,9"51Testing软件测试网 id+Xg&Qt5R

O1}"W;V'a,Q X O n0           InputKeys strPassWord

&W;Vf!Nz)T7e0

a2z gF'{+N0           PushButton Click, "Text=登陆"

k}!m$cMtUA.j0

+R-@4x v r;cHG"}0           Window SetContext, "Caption=登陆;Class=#32770", ""51Testing软件测试网@$n{$Y&@9vM,y#[4\,o8Hv

$FS PK7K#@w0           PushButton Click, "Text=确定"

9c]eJ.c$NU_051Testing软件测试网)k Dir mG

    wend51Testing软件测试网5SAj p |)p;t8`6YlP

7l P*oRV/F@y X/K{0    dp_Result = SQADatapoolClose (dp_id)  

4q2m2Ljb MKJJ0

h{1HeuK2q0End Sub

,W k-d-~7R`t0

相关阅读:

TAG: Datapool TestManager 自动化测试 实际应用

 

评分:0

我来说两句

Open Toolbar