QTP学习分享
k:tDCT#W0X01.在测试中我们使用QTP调试脚本的时候一般就是DEBUG或者MSGBOX察看一些信息,其实有时候也可以使用print来实现批量的察看信息但是不影响程序运行.
3L,@@*H;tW)n']0运行脚本:51Testing软件测试网 Ul.z uPj\
a="100"
"l/b8Z"Y:kG&lJ4^Y:^;u0print a51Testing软件测试网Jf:O5vR5W;x}
~~~~~~~~~~~~~~~~~~~~~~~~~51Testing软件测试网-[5X|{:E l&A(M @B
2.取datatable特定行的数据可以这样使用
*c|_R[Y2@0运行脚本:51Testing软件测试网*w'Qs1m.H
DataTable.GetSheet("Action1").GetParameter("test").ValueByRow(4)51Testing软件测试网4DnaU-f+I
~~~~~~~~~~~~~~~~~~51Testing软件测试网,b N
Mzw
3.Wait Seconds [, Milliseconds]可以精确到毫秒.51Testing软件测试网E
h5g2\2yF2|;J
~~~~~~~~~~~~~~~~~~
5@3bAX?C-e8sg8h04.在自定义的function里面数组作为返回值.
)y?SpJ0运行脚本:
l4t^ d Ri6d0circuit = "399937"51Testing软件测试网7N)lQJ3Kq!qF)G:h-j']
Function trimString(circuit)
-`dkqr
n0Dim holdArray(5)
B;q/dM.z7P5d*b q"X0holdArray(0) = Left(circuit, 2)
2`~5x4\0x/bTl0holdArray(1) = Right(circuit, 2)
h Q:rU;w/T6pq0msgbox holdArray(0) 'showed 39
.?k@*kG4E0trimString = holdArray' I get an out of range error here
U)I.U Y[tKl'e2_0End Function51Testing软件测试网qN'O7Mu1G
dim myArray
!R+dpz|:l&{#cQ?:Y0'here I want to assign the return array to another array51Testing软件测试网Zii2dD'^a6w%HDz
myArray = trimString(circuit)
Y,|1P[1lNQ0' and then call one element from it
9Y6df}JB0msgbox myArray(1)
D`
WJ"Yv2z.F0~~~~~~~~~~~~~~~51Testing软件测试网"x F@N%I
P
5.计算一个操作的时间.
4Tbf]r
jzL{!K0运行脚本:
q:FS^%jQ+y0R0Browser("Browser").Page("Page").Image("getRates").Click51Testing软件测试网'@,l?.h!w3p
l
f
var_StartTime = Timer
T_d C(sh`,z0Browser("Browser").Page("Page").Sync51Testing软件测试网VU9t:Ks p6R"Y
Browser("Browser").Page("Page").Check CheckPoint("Check1")
8V6i JC2np!i0var_EndTime = Timer51Testing软件测试网si5w#sK |
intRespTime = round ((var_EndTime - var_StartTime), 2 )51Testing软件测试网1o%Q]UxU8A*T
msgbox (intRespTime)
Eg;~;nkmI0~~~~~~~~~~~~~~~51Testing软件测试网'~i3B7w4Q\R
w?p
6.取得指定sheet(datatable)的行数和列数(也可以理解为参数个数)51Testing软件测试网(U3^
X\+R }+PK
paramcount = DataTable.GetSheet("Action1").GetParameterCount
l)H'IMY
iy~0msgbox "There are " ¶mcount&"columns in the data sheet."
E%[e1r;N Y0rowcount = DataTable.GetSheet("Action1").GetRowCount51Testing软件测试网4e+dW3rG*rtxa
msgbox "There are " &rowcount&"rows in the data sheet."