QTP的Setting对象详解

上一篇 / 下一篇  2011-12-01 22:17:22 / 个人分类:QTP/UFT

51Testing软件测试网%g5u G1v.tM`t:Z`

可以使用Setting对象修改测试运行过程中的设置,该设置只在当前测试运行过程中有效,不会改变test setting及option里的实际设置

G_!U.Wh e;?t0

R,[b(A)bM_0*方法:51Testing软件测试网%\-Vc7v&xS
add 添加设置运行时自定义设置51Testing软件测试网 m1JA&DN^~ hDUQ:h8l
exists51Testing软件测试网(Z*v8P]f B"y r
remove  移除自定义设置51Testing软件测试网Rd/O w&C&j:L e

y;`"cZC0*属性:
~e I7l b N M0item 
z-wdUC0webpackage51Testing软件测试网#c;C jC }dAY/T

51Testing软件测试网5J:@ R8fN`h#K8i^

*QTP定义的setting设置:
(`Ywq0\-iZ"\0AutomaticLinkRun:  设置自动检查点是否运行 true/false51Testing软件测试网R7@;U|-T/`U7A7t!V,Z
DefaultLoadTime:    默认录制时对象加载时间/s
gmz^1c?^0DefaultTimeout:  默认超时时间/ms51Testing软件测试网?@[x i~;X
SnapshotReportMode:  (和option里的screen captrue的设置作用是相同的) 默认为1,可选值为0,1,2,351Testing软件测试网M&w3E7b-p |)]@aA3}
WebTimeout:  页面加载时间/s51Testing软件测试网 Xk??2vX*Ti#~

oB n"N7r0*webpackage包含的2个属性51Testing软件测试网1T6c.]v\ t7k
ReplayType
zmaqvQ3q K01.页面方式运行
D3y3S0r.S u02.鼠标运行51Testing软件测试网uPcMC

51Testing软件测试网7xoS+_-I|

Setting.WebPackage("ReplayType") = 251Testing软件测试网n1I9F,u8j/^1| ^

51Testing软件测试网k|1u)SH?

ReplayUsingSourceIndex
f$fAm9Q Jj IZ/t@0
|CC["L4Ea00.回放脚本时不使用index属性定义对象51Testing软件测试网c0hN!]p)n"G"WQBk%U
1.使用index属性51Testing软件测试网 BJ WC/\)vtE"aae
Setting.Packages.WebPackage.Settings("ReplayUsingSourceIndex") = 051Testing软件测试网']*^Pa^

D#@C$QGf0k;Z051Testing软件测试网OcA4sa*|y:w(m
我们可以自己设置运行时的自定义设置51Testing软件测试网#z*s|v(H6XY

;Y|SUF A2S0If Not Setting.Exists("testusername") then   Setting.Add "testusername", "john"
.E$CM1@-_Dh7\4?0else51Testing软件测试网t'EJ-nP?
…………51Testing软件测试网p x(J1cA&]"@^ B
end if51Testing软件测试网K sKm2N

3B:xO0}"V/B3Q0然后可以在测试中调用
+b6wb/P ^&b+[,O0username=setting("testusername")

)T@mPQb1~g0

TAG:

 

评分:0

我来说两句

Open Toolbar