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

SQAUtil.sbl

上一篇 / 下一篇  2007-01-05 16:49:01 / 个人分类:Robot技术

'$include "DpConst.sbh"51Testing软件测试网y7w_j1i_"T

#jLAQg(]s0Declare Function LCSdatapool_open Lib "rtlcs.dll" (ByVal pszDpName$, ByVal dwFlags&) As Long51Testing软件测试网} q'L2\"PN+mOJ#}
Declare Function TSSErrorDetail Lib "rttss.dll" (ByVal pszErrText$, dwLen&) As Long
,r"G R5WI(p0Const  SQA_DP_WRAP = &H0000000251Testing软件测试网yK:s{oZZF"{H
Const  SQA_DP_NOWRAP = &H00000020
\)Pj(S/`m0Const  SQA_DP_SHARED = &H00000004
X)^@ ZJOs1G{0Const  SQA_DP_PRIVATE = &H00000040
G,Nc8c(j9jN051Testing软件测试网 U~q0E%G([QI
' The last error number returned from the LCSdatapool_position_value and
`4fpwpKAEa0' LCSdatapool_name_value functions.
T+X5g#r${wp0Const  LCS_LAST_VALUE_ERROR = -351Testing软件测试网1bm n0YS6~ \
51Testing软件测试网ZPw jU~~
Declare Function LCSdatapool_position_value Lib "rtlcs.dll" (ByVal dwDpId&, ByVal dwColIndex&) As Long
j0O*o6jS(Rp/TO0Declare Function LCSdatapool_name_value Lib "rtlcs.dll" (ByVal dwDpId&, ByVal sColName As String) As Long
`,@(?4hMU;vh6[0Declare Function Dplstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long
5y;hK|{'O0f(c0Declare Function Dplstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long51Testing软件测试网2Mj-V]iXq5j)`i3}e
51Testing软件测试网0e A8KP4rfk
' ----------------------------------------------------------------------------51Testing软件测试网 rm ~)I(@ C}b
Const  SQA_DIR_RUNFILES         = 1  ' Install Directory
6S |a"} U"I{D051Testing软件测试网!}t [7rt5f
Declare Function UTLGetDir Lib "rtxutil.dll" (ByVal DirType%, ByVal lpszPath$, ByVal cch&) As Integer51Testing软件测试网\3h&T/`k Yx
Function SQAGetDir (iDirType as Integer) as String51Testing软件测试网/tlO[+ee6t E&g
    ' Returns standard directories used by SQA Suite apps
N)n$O(Z:EC0    Dim sDirPath as String, Result as Integer51Testing软件测试网 z.`nHp(u#BXp
    sDirPath = Space$(260)
7mYJA a l0    Result = UTLGetDir(iDirType, sDirPath, 260)51Testing软件测试网'I~m @5x
    sDirPath = Left$(sDirPath, InStr(sDirPath,Chr$(0)) - 1)51Testing软件测试网@0Q tp)^ Vd
    If (Right$(sDirPath, 1) <> "\") Then sDirPath = sDirPath  + "\"51Testing软件测试网UR(t(~}` m.a+Ry
    SQAGetDir = sDirPath        
YO%C)MNFq0End Function
eN.C7|?#M-l0' ----------------------------------------------------------------------------51Testing软件测试网B3v4Y UVA_He1w,v
Function SQAGetPropertyNames( objectRec As String, propertyNames() as String) As Integer
(P^#oDW)?1_6c0    Dim ret%
?uW p#t0    Dim sList as Variant51Testing软件测试网O3\ Y$G!Zh;DN9]J {-e
    ret = SQAGetPropertyList( objectRec, sList)
m8w-| y&L!Z,Q)GuN4\0    If ret <> sqaSuccess Then
N)@4gzdE,E0        SQAGetPropertyNames = ret
/U'n-G1G0Z2Aa0        Exit Function
u]I/c*Z'L!DF }6~0    End If
9t Q%_4Q(mqBN/x0    
B @A|7a+{7Qp#J0    Dim cObj%
c:R8m4A*{!^A"JPX0    cObj = SQAGetListCount( sList )
[Yu&e xE!~9W0    ReDim propertyNames( 0 To cObj-1 )
]*gP M:a$n3Q!V0
,a:J8S;MZX3tu7F4C0    Dim i%
1I_uR5kr[4g0    Dim vName as Variant
5U$Y(rfY7K'YL,o0    For i = 0 to cObj-1
/H#R!uA@*^AC0        ret = SQAGetListItem( sList, i, vName)
%oH#rD}MT$A|0        If ret <> sqaSuccess Then51Testing软件测试网X8q9Iy4tP\2{
            SQAGetPropertyNames = ret
FW Yn#t0            Exit Function51Testing软件测试网#F;j~A.r*I ZU:X6}yO:D
        End If51Testing软件测试网C(c0H1z4I.|d$I:d7~.o
        propertyNames(i) = vName
5M2W {Tu:C;U8^0    Next i51Testing软件测试网u c(A3E N[b
51Testing软件测试网.s:B_(f;r\'zZ
    SQAGetPropertyNames = sqaSuccess51Testing软件测试网4om!Gs9X muC9e
51Testing软件测试网(L.B#f(gw6f7b
End Function
0B7wJ7j@s:@NR0' ----------------------------------------------------------------------------51Testing软件测试网c|y8y4Rl
Function SQAGetChildren( objectRec As String, childRec() as String) As Integer
[(_P/ksH#h0    Dim ret%51Testing软件测试网 ?1?q8c,H9l
    Dim sList as Variant51Testing软件测试网 bV{0E+G
    Dim parentPrefix as Variant51Testing软件测试网0yS*@HW"r M&@b
   
[/HE R)A|pM0    ret = SQAGetProperty( objectRec, "FullRecognition", parentPrefix )51Testing软件测试网C"raa"~2k2N O*R
    If ret <> sqaSuccess Then
"q9r.Mb:ea ]0        SQAGetChildren = ret
qe G.X@\(}p1~2]a0        Exit Function
sw Uwf7| Po/?0    End If51Testing软件测试网yS#P+]7?*Q(^ h~!i
        parentPrefix = parentPrefix + ";\;"51Testing软件测试网C2q:cpQ7`~2w5_
   51Testing软件测试网4ple X3L |Q
    ret = SQAGetChildList( objectRec, sList)51Testing软件测试网 N Sq2{+d0AVHv
    If ret <> sqaSuccess Then
)oh:E;l:s/Icn0        SQAGetChildren = ret
@ti"LJN%vf+K.p ni0        Exit Function
P$S:M;dSl2L;?0    End If51Testing软件测试网UTKD8K
  51Testing软件测试网p-L4~}#K)O
    Dim cObj%51Testing软件测试网.V!X3T$NL&k
    cObj = SQAGetListCount( sList )51Testing软件测试网_8MO c[h`e
    ReDim childRec( 0 To cObj-1 )
5Q'P \G{"sH|;r dF+h0
F/r G:b X lS0    Dim i%51Testing软件测试网&j|&h*{.p nv
    Dim vName as Variant
-rI&Ix,{v6tn~ E'~0    For i = 0 to cObj-151Testing软件测试网)q3^l;w8Ny OFNY
        ret = SQAGetListItem( sList, i, vName)
r(W-m^ZDOZ P?0        If ret <> sqaSuccess Then51Testing软件测试网KiX/c6Z2P-m#m
            SQAGetChildren = ret
Ue?}y)p&q0            Exit Function
.x5J ~&p?1y |g0        End If51Testing软件测试网9L%b?!u9O"H
        childRec(i) = parentPrefix + vName51Testing软件测试网 [9U/sk+bt y2D
    Next i
a[:?,a\ c-zt f0
s,e Y rD!K(A:kv0    SQAGetChildren = sqaSuccess51Testing软件测试网,MUIi,`t9a
51Testing软件测试网%Jb$s5ng:T1d'e
End Function
P {[*Vvw0' ----------------------------------------------------------------------------51Testing软件测试网3a-|!_ [ AH-F)tY
Function SQAGetPropertyArrayAsString( objectRec As String, propertyName as String, propertyValues() as String) As Integer
1VA n ? S0
&R Y%zLO1xU2x$?"IC0    Dim ret%
e6P'A']2@Qn0    Dim val$
K!P!k QNu$h3K0    Dim i%, p_sub_i$51Testing软件测试网7@(Cs7?(]:o1J^
    Dim cProp%
F)B#Lb [x.Z!_0
6a [F4}^-P8g0    ret = SQAGetPropertyArraySize( objectRec, propertyName, cProp )51Testing软件测试网&`za5\hS:HdV
    If ret <> sqaSuccess Then51Testing软件测试网,fTxZ NZ#[(j
        SQAGetPropertyArrayAsString = ret51Testing软件测试网CJU'w yN"_}&r/h
        Exit Function
(D7S#\&QKS$S:x0    End If
{^z&hj w"t1y$C0
M-q7{$Z,?0    ReDim Preserve propertyValues( 0 To cProp-1 )
{+A:H l\X _t0b0   
gLE P7Hj5j.{0    For i = 0 to cProp-151Testing软件测试网!kf$Avg l'j
        p_sub_i = propertyName+"("+str(i)+")"51Testing软件测试网u Y"w5ioBxZo
       51Testing软件测试网2]1Fg w4n:m Z){ |P
        ret = SQAGetPropertyAsString( objectRec, p_sub_i, val)51Testing软件测试网 nFwMN D3K
        If ret <> sqaSuccess Then51Testing软件测试网vBn4V)o$t3I2y|+t
            SQAGetPropertyArrayAsString = ret
pv0W5TD_5k.`z0            Exit Function
7m6Kv[ g(]0        End If
|8a5py:H$E!WRSP0        propertyValues(i) = val
,Gm.Yu+j _G.E Sz4R0       
{,WX a4c [3{)X+L0    Next i       51Testing软件测试网/R`v8wH8|8V(o6An:[
   
lA%F$n9S@N0Cb0FR0    SQAGetPropertyArrayAsString = sqaSuccess
z+ygu NY0
e ]fI}&Agy4Ut0End Function
I)v b*D0M!H0' ----------------------------------------------------------------------------
MP Z]D6T|0Function SQAGetPropertyArray( objectRec As String, propertyName as String, propertyValues() as Variant) As Integer
uXg0O2`Qf]+buHy0
p&]Oq'Um/x0    Dim ret%
bB9Tsn+d+wgG0    Dim val as Variant
D(n Fg7T.l0    Dim i%, p_sub_i$51Testing软件测试网,oL!In/_k3Z8Dxg
    Dim cProp%51Testing软件测试网8gEHz,l
51Testing软件测试网 b4F7V2ol-U
    ret = SQAGetPropertyArraySize( objectRec, propertyName, cProp )
'E"h9q.W%W hM0    If ret <> sqaSuccess Then
j3NA e&A0        SQAGetPropertyArray = ret
;H&?,F7J j:C{-C0        Exit Function51Testing软件测试网9Z w s(og
    End If
'o.zk5H%]2KU051Testing软件测试网O2zd!j0e\)s
    If cProp>0 then
*CNjm$e/r0        ReDim propertyValues( 0 To cProp-1 )51Testing软件测试网n@.l!?.G
    End if
&V{|KBnI:I0
Lr8p| x9d&Um0    For i = 0 to cProp-151Testing软件测试网/T1w(Q Q'u)|x6h#[
        p_sub_i = propertyName+"("+str(i)+")"
Sf'j;Fjqw0       
%Nso},i%_!W2Ze0        ret = SQAGetProperty( objectRec, p_sub_i, val)
9[Bza'\[9c-LG7`0        If ret <> sqaSuccess Then51Testing软件测试网6Y/F |?x @~!}
            SQAGetPropertyArray = ret51Testing软件测试网 k5fK3})cUi
            Exit Function51Testing软件测试网9NhC6FHMi
        End If51Testing软件测试网-?3f5Z)_T/kqS
        propertyValues(i) = val51Testing软件测试网7@?MTV
       
E0t |3fIeL6}6m'Z j0    Next i       51Testing软件测试网/J]`"e9z1L
   51Testing软件测试网'R'D*ix5J{G*KE*Z]
    SQAGetPropertyArray = sqaSuccess51Testing软件测试网9x}4k[7fjZ^end
51Testing软件测试网6S#^eU6K:n-N(b(f2]
End Function
l#W,|f/T:Kl0' ----------------------------------------------------------------------------
Fmg a8[!R4J%J0Function SQADatapoolOpen (pszDpName As String, Optional bWrap As Variant, Optional nSequence As Variant, Optional bExclusive As Variant) As Long51Testing软件测试网'H%A} ` [RUx6lVB
    Dim lResult As Long
w hI-qU,n2J`0    Dim dwFlag As Long51Testing软件测试网+e_\ Z AQ4X
    Dim lLength As Long
{-T!J$u(Mv/G0    Dim sErrText As String
7vkOz+K|0
6GDq6Q(DIR#nu0    lResult = sqaDpSuccess
&r4Q RL;jT1L0    ' Set the optional parameters to defaults if missing51Testing软件测试网p/]3|~z4Rd0D
    If IsMissing(bWrap) = -1 Then
w(WSO S4Up"^0        bWrap = false51Testing软件测试网 I2Hi:`l%u
    End If
wtnb9g%@;n0    If IsMissing(nSequence) = -1 Then51Testing软件测试网]~0P4d9z
        nSequence = SQA_DP_SEQUENTIAL
2P:]J%nO,w pX D0    End If51Testing软件测试网J4[ un5FS ]U
    If IsMissing(bExclusive) = -1 Then51Testing软件测试网4H`XrG$k+[h
        bExclusive = false
/IaxP2|$j3O2_\{0    End If51Testing软件测试网#l f}{)w-N }:e
51Testing软件测试网5j(g[P5a#_2M
    ' Check if the optional parameter is correct type
wgp:f UKA0    If Not VarType(bWrap) = 2 And Not VarType(bWrap) = 3 Then51Testing软件测试网;Y.L!k%aM3UkF
        lResult = sqaDpInvalidArgument51Testing软件测试网q7| ^D7`iQ7O
    End If
4Q.Y A4I m(J0    If Not VarType(nSequence) = 2 And Not VarType(nSequence) = 3 Then
.gqL?/R1[-P`0        lResult = sqaDpInvalidArgument
P?F]DDk}+a4aj0    End If
f'm1G.C.}x L0    If Not VarType(bExclusive) = 2 And Not VarType(bExclusive) = 3 Then
}i3u;Ug0        lResult = sqaDpInvalidArgument51Testing软件测试网 c)}k'cK5K{A
    End If51Testing软件测试网5F NM%R2C3pedk
   51Testing软件测试网/uK.x;D F4JaC
    If lResult <> sqaSuccess Then51Testing软件测试网0lrT XrqX
        SQADatapoolOpen = lResult51Testing软件测试网%_*c5rFU*xV
        Exit Function51Testing软件测试网/}/x:C6g dn?
    End If51Testing软件测试网$AulL9Bxw3\bM u
       
#{KH8m}|"M1t0    ' Build the dwFlag
7Sa0M!w.I+d*Kt}0    If bWrap Then51Testing软件测试网%S \~8is&Q8Hx"r
        dwFlag = SQA_DP_WRAP51Testing软件测试网+Xk9t(T,^Yo1T
    Else
bL9V+Y&C0        dwFlag = SQA_DP_NOWRAP
wRe&W~|&RZx0    End If
*|5gBm?|0
\ j?L'tzCt.e;n0    If nSequence = SQA_DP_RANDOM Then51Testing软件测试网1u_ MP%Te
        dwFlag = dwFlag + SQA_DP_RANDOM51Testing软件测试网Zn'HW-@
    ElseIf nSequence = SQA_DP_SHUFFLE Then51Testing软件测试网+n,ml)E9o"oy @ FS
        dwFlag = dwFlag + SQA_DP_SHUFFLE
K?U2wngE0    ElseIf nSequence = SQA_DP_SEQUENTIAL Then
X u7KEe.q0        dwFlag = dwFlag + SQA_DP_SEQUENTIAL
T8Z.@+N-pYJ0    Else51Testing软件测试网bCHFeW
        SQADatapoolOpen = sqaDpInvalidArgument
*D)L ^^]8b9h B)K0        Exit Function
7{wb\{q{[0    End If51Testing软件测试网)LEk4t|k
51Testing软件测试网o:`H:aeKkS
    If bExclusive Then
}#f+l*_1mH S0        dwFlag = dwFlag + SQA_DP_PRIVATE
*N%siHTpLZt0    Else
[ X6b;s]%o9k0        dwFlag = dwFlag + SQA_DP_SHARED
;`F}6f7U.k0    End If   51Testing软件测试网/P,t y-hu9h
51Testing软件测试网2~(J o?+\i;D;mu
    lResult = LCSdatapool_open(pszDpName, dwFlag)51Testing软件测试网Y+KF Y B[6\
    if lResult < 0 Then
.p$Q/@3Fa/xd0        lLength = 160
dBE q^ZP+Ws0        sErrText = space(lLength + 1)51Testing软件测试网v]"} |#ph6q#d3E
        lResult = TSSErrorDetail(sErrText, lLength)51Testing软件测试网0F2eo:eLw:K-^
        If lLength > 160 then51Testing软件测试网K[*{,qZV/Bo
            sErrText = space(lLength + 1)51Testing软件测试网B.Xj-PoG"\b,v\8yI
            lResult = TSSErrorDetail(sErrText, lLength)51Testing软件测试网,l_%M9P2@'BJMf
        End If51Testing软件测试网K(X5yG~#Ljb8_
        SQAscrīptCmdFailure sErrText
]:ty m*n6K.c}0        SQADatapoolOpen = sqaDpFailure
q_*_o[LJ6_fa0    Else51Testing软件测试网e3~5IWl&Eg O1@4vS
        SQADatapoolOpen = lResult51Testing软件测试网/]5`9wXYf2t%H&}
    End If
q3|6eI;o)I x-C0   
@2J U,J3N(Z^8H\.h0End Function51Testing软件测试网C4C KM{)iYwe$u dVH
' ----------------------------------------------------------------------------51Testing软件测试网9[6o [!~-m
Function SQADatapoolValue (dpID As Long, dpCol As Variant, sValue As String) As Long
+UW:M g#e s*E3Wq0    Dim lString As Long51Testing软件测试网p K ^pdBr p
    Dim lLength As Long51Testing软件测试网t.g OKiF1I
    Dim lResult As Long51Testing软件测试网)u0e [J^!E/r~
   
/n6Ke-a,l F'L$i0    lString = 051Testing软件测试网!A/sP-H x*Z f
    lResult = sqaDpSuccess
^YDm{ ?]+|b0    If VarType(dpCol) = 2 Or VarType(dpCol) = 3 Then
}nUs a*e0        lString = LCSdatapool_position_value(dpID, dpCol)51Testing软件测试网^-iIp?y K[N
    ElseIf VarType(dpCol) = 8 Then
f ZlW4e/N;o0        lString = LCSdatapool_name_value(dpID, dpCol)51Testing软件测试网6JN~o0r!O
    Else
B2ht({2j?0        SQADatapoolValue = sqaDpInvalidArgument51Testing软件测试网%?ek7?U%z {3z,h+Q g%o
        Exit Function51Testing软件测试网 s8a8f d%N2@qM7~
    End If
b9At.Z;[q4KBu051Testing软件测试网8@ N z_F`1F%~&C o%S
    If (LCS_LAST_VALUE_ERROR <= lString) And (lString <= 0)  Then51Testing软件测试网$M7G+yR.]SJ#@
        sValue = ""51Testing软件测试网oAh-?Tf"`!G
        ' Preserve interesting errors51Testing软件测试网)|*ygkp1v[
        If lString <> 0 Then
(q2^8L3Q0N0{0            SQADatapoolValue = sqaDpFailure
P;]!|&h8SD)@(S0        End If
k!}|"l`5YajL0    Else51Testing软件测试网 w+qq[?dXy
        lLength = Dplstrlen(lString)
_J%u3lvV;G0        sValue = space(lLength + 1)
%U"|2~'\*E"Tg.Af0        Dplstrcpy sValue, lString51Testing软件测试网5w ER ~~}
        sValue = Left$(sValue, InStr(sValue,Chr$(0)) - 1)
4DAV C8|d;KAg0    End If
,c+B-b,d!\0End Function
[:} N c$b i*x051Testing软件测试网0w2fv4@*f
'
jJW4Q@8Y.v'a1~B0' Clean String - Cleans out HTML tags
A6s#_ r5I\8SuWT0'
Z/EB ] Z J9r-Z0Function CleanString(TargetStr As String) As String
F,}`2Fa*U0DNz051Testing软件测试网XmT#h(f"i
Dim NewStr   As String51Testing软件测试网g5bc T ^Q
Dim Position As Integer51Testing软件测试网'gtt/iR7@
51Testing软件测试网:C*p$oP;`&JfC
    Position = InStr(1, TargetStr, "<")
){x d2[H,?-D7qVG0    If (Position > 1) Then
4Ak6mEU$?0        CleanString = Mid$(TargetStr, 1, Position-1)
yC"s;N m,] u#S0    Else
:i3R$LZ4F$]P{M^0        CleanString = TargetStr51Testing软件测试网C(V7VpUy
    End If51Testing软件测试网J,_yE0P
51Testing软件测试网z\J t4mSC
End Function
*aLHo b)Iqm0
2QBbsUf0'=================================================================================
/hkkWU hq0' FindAndLogString --51Testing软件测试网;r t9Qmt@4I
'   Open a file to search and find all occurances of the string.  Log the results
jcv @eZ:as {/v0'   to the log file and close up when complete.51Testing软件测试网#\^` |3Q1w&G
'=================================================================================
)g8l h7]v]0Function FindAndLogString(FileName as String, SearchText As String, LogEntryType As Integer) As Integer51Testing软件测试网 Al(_2F)Aj9m)h

Z-y|6]I0Dim SearchedStr, FoundStr As String
^0Rjz$FkVA7rXX8Gj0Dim Position As Integer51Testing软件测试网+}"W5?*M+[-o-k4b0t H.e7}
Dim LineNumber As Long51Testing软件测试网 aSp~_k
Dim FileNumber As Integer
fp1G^+x3?&`)?T0   51Testing软件测试网Nc1]RW
On Error GoTo BailOut
sADaO2WV*l[0Ypj051Testing软件测试网O_#O%M.A$L-T
    FileNumber = FreeFile
&s3u(C/?CT"u+B"bY0    LineNumber = 0
|8W `c^c0    Open FileName for Input As #FileNumber51Testing软件测试网3{.U5z h#t~9{+O%u
   51Testing软件测试网(JGW|#Ij
    Do Until EOF(1)51Testing软件测试网8iXW?#w!nSG
        Input #FileNumber, SearchedStr
T~\)B[c3T-O7c0       
(h!F4c\+En` zK0    ' Increment the line counter51Testing软件测试网%~ Om#z&u{^2Z$e-B r
        LineNumber = LineNumber + 1
IXXV ZS7O0       
.~6]'^,?rnM0    ' Search in the string for the desired text51Testing软件测试网0u vZov ~-e4l&c3B
        Position = InStr(1, SearchedStr, SearchText)
:VP6n,z/`0        If (Position <> 0) Then51Testing软件测试网\(] Nn%x.|]Q#Y
            FoundStr = Mid$(SearchedStr, Position)51Testing软件测试网,p I(Bw!NG
            SQALogMessage LogEntryType, CleanString(FoundStr), "Found at line: " & LineNumber & " in: " & FileName51Testing软件测试网w\3Wr'bWJS}
        End If      
"FIk9D"gn S0    Loop51Testing软件测试网)K+n`x y:A9H&v

KUZz"`1O;F k0    Close #FileNumber
$tw d&H$h&`^0
b \!S j @8{3R lm0Exit Function   
:][:lV _c#W-oS7_!~-S@0   51Testing软件测试网G_y/m+h;i
BailOut:
ss_GN0   51Testing软件测试网E0T0[@0V P!e
    MsgBox "Error " & Err & ": " & Error$51Testing软件测试网2mBIk5V-iJ [v
    SQALogMessage SQAFail, Err & ": " & Error$, "File Error"51Testing软件测试网3eq$Uy.i7t`SeC
   
1F8n)vSmi'QE \0End Function51Testing软件测试网?Ob:K[^1e+B`
51Testing软件测试网m V3K2Bd:Cn#W
' ----------------------------------------------------------------------------
TX8Sj6f/k:|8J&U i0'---------------------------------------------------------------------------------51Testing软件测试网UnbZ.xe!j%S H y
' SQACreateBaseline() -- Call the install analyzer to create a baseline snapshot
|.eMk @ oJ:L+BV}S0'---------------------------------------------------------------------------------
|6z"S0fi#k:e0Function SQAEnvCreateBaseline(fileName as String) As Integer
O n j:c2oJVK3r051Testing软件测试网l,H$DZ*DJw
    Dim FullPath, CommandStr as String51Testing软件测试网$E$}o|L
    Dim ToolRoot, LogRoot As String
akEO6V)A9iw0    Dim Result as Integer
Y,?-I,zWSQ;T0   
j:^9r l{6Qr0' Get the target directories
9t$phl:[0    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)51Testing软件测试网S EsK~9X6V
    LogRoot = SQAGetLogDir
,|&fe1dP8dq;[a e"n0   
&x!BH ^2IY|!vV{0    SQAEnvCreateBaseline = 051Testing软件测试网Z4|4X&sRD)D}
   
FG{0v%b"nd0    FullPath = LogRoot & "Results\" & fileName & ".ans"
m/m/S{o r7S7U;w4G0    CommandStr = ToolRoot & "Analyzer /nologo /bc:" & fileName & " /res:" & LogRoot & "Results\"51Testing软件测试网xp*?!F7D|g

Ca/@-p-I^0On Error Resume Next
~Z^2N3a-ZU0    Kill FullPath
UcU1K0c j8p0   
CI-HV/w!Z0' Turn off logging, there's no need to see the file VP in the final log file    
NuL&W/FZ#I8r0    SQASuspendLogOutput51Testing软件测试网^:Az2[x&u#xV?

X^IX.~Hv!y0' Execute the command   51Testing软件测试网'gTd0Yd3\(`
    Shell CommandStr, 1
2?J'W&OXR0   
[)vAYeAv.Q9jw0    FullPath = "Name=" & FullPath51Testing软件测试网8V*?yA K&C9bv
    Result = FileVP(Exists, FullPath, "VP=Baseline Analyzer File;ExpectedResult=PASS;Wait=10,1200")51Testing软件测试网!pyPJH]F_D
51Testing软件测试网w'~-j8x6k:}8n8L?
' Turn the logfile back on51Testing软件测试网 B[rrL{ j+n T
    SQAResumeLogOutput
8paz0]D2Vsc'yK ~051Testing软件测试网!_,p6P/kw4M
' Grab and close the Analyzer Window51Testing软件测试网b f$f eF5_R
    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""
,u"wctH:r F0    Window CloseWin, "", ""51Testing软件测试网$p;e _]]:[

Si/NH:l0    SQAEnvCreateBaseline = Result51Testing软件测试网2C-y+zJ|-`8d
   51Testing软件测试网B0K0]3S6O;BT}
End Function51Testing软件测试网S5MT2`;IyRZ!]

|U]%?1i!F0'-------------------------------------------------------------------------------51Testing软件测试网ub4M~QD2oY+q
' SQAEnvCreateCurrent() -- Call the install analyzer to create a current snapshot
s|!c&h,vG2s0'-------------------------------------------------------------------------------51Testing软件测试网gq'Q8F)g5{+tk
Function SQAEnvCreateCurrent(fileName as String) As Integer51Testing软件测试网D;Xkms7^
    Dim FullPath, CommandStr as String51Testing软件测试网6\jU,rJ9Sq
    Dim ToolRoot, LogRoot As String
%bS+\;_BX7P0    Dim Result as Integer51Testing软件测试网8cy4z.ag7jk
   
;NsUp&c[ @0ll&Yc0' Get the target directories51Testing软件测试网+m1M4qr.{%R
    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)
PX(p3r1Sj-P*s0    LogRoot = SQAGetLogDir51Testing软件测试网 F'qy2\5c M j?
   51Testing软件测试网lF| lK9j
    SQAEnvCreateCurrent = 0
*vPM)Xt5vq0
2n To#d I3F*aS0    FullPath = LogRoot & "Results\" & fileName & ".ans"51Testing软件测试网3` FM O[:n
    CommandStr = ToolRoot & "Analyzer /nologo /cc:" & fileName & " /res:" & LogRoot & "Results\"51Testing软件测试网6NS3NUq6{#]
        
mIbS6v#?uj0w4EE:s`0On Error Resume Next51Testing软件测试网HRXk4DD
    Kill FullPath
0mb/^~D0   
.p;jYg8vXj5O`0' Turn off logging, there's no need to see the file VP in the final log file    
5h5G)q L p*`iX0    SQASuspendLogOutput
(bO0a,y]0
!MUe7ok@0' Execute the Command
x6b?1Sck)wCM0    Shell CommandStr, 1
1t#h#L9NXV%x,hn-Q0   51Testing软件测试网\8phy1L]y(_5v
    FullPath = "Name=" & FullPath51Testing软件测试网9z2V!X!K9X:U.N&vc
    Result = FileVP(Exists, FullPath, "VP=Current Analyzer File;ExpectedResult=PASS;Wait=10,1200")51Testing软件测试网 LlI(ecs

e$B6~r2}_H?8A0' Turn the logfile back on51Testing软件测试网(c+b gr"x~+d
    SQAResumeLogOutput51Testing软件测试网d1?2lE4~3Ib

4\|QNzY7vy0' Grab and close the Analyzer Window
nCV*nV0    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""
Vf5wx,e&gSPK*}0    Window CloseWin, "", ""51Testing软件测试网 AFE~8vy%E

.g)z5~(j![4l8~m,U CE0    SQAEnvCreateCurrent = Result51Testing软件测试网+{G&}5ou$a*s+GF
   51Testing软件测试网@.Em$cKH
End Function51Testing软件测试网"u7s"hG*aO
51Testing软件测试网yZ A S]2A
'-------------------------------------------------------------------------------51Testing软件测试网,T'q [BB&h
' SQAEnvCreateDelta() -- Call the install analyzer to create a current delta report
T1I1jf _E0'-------------------------------------------------------------------------------
e.sC|.r3Z&q+S b'R0Function SQAEnvCreateDelta(Baseline as String, Current as String, ShowReport As Integer) As Integer
!Q-opiGK0
v9?m.ps mKn!Y0    Dim FullPath, CommandStr, ErrorPath,SearchedStr, FoundStr As String51Testing软件测试网'UM`0rn/t
    Dim Position As Integer51Testing软件测试网(]N4Qt vr
    Dim ToolRoot, LogRoot As String
D7c?gb\5r0    Dim Result as Integer
z\(A3X`6U4Y*}0
Z0kH,nM#{[#b0    SQAEnvCreateDelta = 0
n,I7A#r7O/u(q)R0       
q~n,w"a5X-^ w0' Get the target directories51Testing软件测试网 O:h/H6J(?sd/kD
    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)51Testing软件测试网F$N fvt\3z
    LogRoot = SQAGetLogDir
0TtVmC4G7F051Testing软件测试网 It5V/J [P
    FullPath = LogRoot & "Results\" & Current & " - " & Baseline & ".htm"
.qtT9V Quc/U0    CommandStr = ToolRoot & "Analyzer /g /nologo /bl:" & Baseline & " /cl:" & Current
Z W1SA'H%Iz0   
N R"G6ZZ_V0'51Testing软件测试网;vIE*T{_
' PHJ - 17-Jan-2000
QUyn&D#iS0V(~:\0'  Commented out and moved the ShowReport functionality to the bottom51Testing软件测试网R4l}G3A [li$` E
'    If( ShowReport = 0 ) Then
K]8y't*xMYB0'        CommandStr = ToolRoot & "Analyzer /g /nologo /bl:" & Baseline & " /cl:" & Current  & " /res:" & LogRoot & "Results\"
8f"x:k$@3F0'    Else51Testing软件测试网6aT'j)\0o&rB(k,AN
'        CommandStr = ToolRoot & "Analyzer /gu /nologo /bl:" & Baseline & " /cl:" & Current & " /res:" & LogRoot & "Results\"
]cOGd V0'    End If51Testing软件测试网%M(P'Od u p&@'x!K[
51Testing软件测试网 lq5d;Z@7Y)Fd
On Error Resume Next   51Testing软件测试网&h_xpR7nj(otc
    Kill FullPath
N nZ y/f)~U`0
7Z/Wc k#W7oON0' Turn off logging, there's no need to see the file VP in the final log file    51Testing软件测试网 y@_L })vM&a9JY5Q
    SQASuspendLogOutput51Testing软件测试网+u+[POxr2q~ }
 51Testing软件测试网q'DbAt @
' Generate the Deltas and wait for the file to be available
k0G`-C%RYS K&W+S#} Y0    Shell CommandStr, 151Testing软件测试网;C*a D u)z
    CommandStr = "Name=" & FullPath51Testing软件测试网 An^$M:@
    Result = FileVP(Exists, CommandStr, "VP=Create Delta Report;ExpectedResult=PASS;Wait=10,1200")51Testing软件测试网e{:{f$hVd4K)x]
51Testing软件测试网$l#P4@(b1u:V Q
' Turn the logfile back on
R#l!n `'e1~0    SQAResumeLogOutput
%a4{M_Z;] Q)i0
Q[&Jje;i0' Grab and close the Analyzer Window51Testing软件测试网]4X'H0O)qP_"xAiZ
    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""51Testing软件测试网8DX ?9u[m
    Window CloseWin, "", ""
kaX2NC&iwam!W051Testing软件测试网3b:F"t+W| @.VE
' Grep for Changes in the delta file -- Grep needs quotes around filenames with spaces51Testing软件测试网8?3bt0qN)qI-mo;j
   FullPath = LogRoot & ".\Results\" & Current & " - " & Baseline & ".htm"51Testing软件测试网)p MS&`t%T

%e5l_Dm"E6L l0jk0   FindAndLogString FullPath, "WARNING", SQAWarning
4N9jk7l Oge0   FindAndLogString FullPath, "ERROR",   SQAFail51Testing软件测试网 LPu"ce_
   FindAndLogString FullPath, "INFO",    SQANone
1r^X5O p oN']051Testing软件测试网~IY:~4u
'
&F]~,X7j Y0' PHJ - 17-Jan-2000
V3v9d+P iP*?({0' If the ShowReport flag is thrown, start a browser with the new file51Testing软件测试网MfzA$Gfm `
'51Testing软件测试网0n0q0UP2MHywQ%S
   If( ShowReport = 1 ) THen
5p U+y*tQ2WO O J A0        StartBrowser FullPath, ""51Testing软件测试网H+Pvq#nz
   End If
:|%L.O^6V]0
``{-}cez,Q0    SQAEnvCreateDelta = Result51Testing软件测试网+\fK^"nt
      
'J!b}({ j3tF5ZB2F1N0Exit Function
Bc&F$w`1B0
?aV[j U0CatchError:
Lx3cB&C_uco7`0
2Nak [.Q/dA0    MsgBox "Error " & Err & ": " & Error$51Testing软件测试网(IoO%LQ"\;S
    SQALogMessage SQAFail, Err & ": " & Error$, "File Error"51Testing软件测试网7apy [(K
       51Testing软件测试网;A7u ?'_u
End Function
KHrQ*`:k E0E0

TAG: 软件测试技术 Robot技术

 

评分:0

我来说两句

Open Toolbar