不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           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"
6hI \8n0v ^f#V051Testing软件测试网 gO9S[-_
Declare Function LCSdatapool_open Lib "rtlcs.dll" (ByVal pszDpName$, ByVal dwFlags&) As Long
C7W!Z9?4eo0Declare Function TSSErrorDetail Lib "rttss.dll" (ByVal pszErrText$, dwLen&) As Long51Testing软件测试网:x.i?,l"c
Const  SQA_DP_WRAP = &H0000000251Testing软件测试网/\buX0\t+Y+u:W
Const  SQA_DP_NOWRAP = &H00000020
a iir%cn2M:wL*Fu0Const  SQA_DP_SHARED = &H0000000451Testing软件测试网pX%d2[l \h
Const  SQA_DP_PRIVATE = &H00000040
:h*eZ}u0
/N8MZ-Z'Lbn t"e-i V0' The last error number returned from the LCSdatapool_position_value and51Testing软件测试网 {w+u5]j4P)Ak X
' LCSdatapool_name_value functions.
#_*p7E(]%nV_*@/B0Const  LCS_LAST_VALUE_ERROR = -3
cnY UK&Z0
)R!^xR8GhD0Declare Function LCSdatapool_position_value Lib "rtlcs.dll" (ByVal dwDpId&, ByVal dwColIndex&) As Long
}X1tv ecq0Declare Function LCSdatapool_name_value Lib "rtlcs.dll" (ByVal dwDpId&, ByVal sColName As String) As Long
X7x8LG.J/Y ~m0Declare Function Dplstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long51Testing软件测试网.c \Eh`*eIa
Declare Function Dplstrcpy Lib "kernel32" Alias "lstrcpyA" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long51Testing软件测试网.R F R{D eY0o
51Testing软件测试网5sSK [&X
' ----------------------------------------------------------------------------51Testing软件测试网)WsB!gy
Const  SQA_DIR_RUNFILES         = 1  ' Install Directory51Testing软件测试网Ql PY m!l/m-j [ u

/\(i M/q;y%Uk\)fD0Declare Function UTLGetDir Lib "rtxutil.dll" (ByVal DirType%, ByVal lpszPath$, ByVal cch&) As Integer
O2EaD_c0Function SQAGetDir (iDirType as Integer) as String
_"M kioK$L]0    ' Returns standard directories used by SQA Suite apps51Testing软件测试网cd$Ia4{
    Dim sDirPath as String, Result as Integer
,GBU,[4kd9}0    sDirPath = Space$(260)51Testing软件测试网;lmWqG7Z
    Result = UTLGetDir(iDirType, sDirPath, 260)
(t_.p$\:xtz!k4}W0    sDirPath = Left$(sDirPath, InStr(sDirPath,Chr$(0)) - 1)
(}C"i)SD&C|W z2r0    If (Right$(sDirPath, 1) <> "\") Then sDirPath = sDirPath  + "\"51Testing软件测试网X4FsYM:z |4mU}
    SQAGetDir = sDirPath        
#QK u f4[3c0End Function51Testing软件测试网NUFK E j+d
' ----------------------------------------------------------------------------51Testing软件测试网 kYj0`m`T&a%]
Function SQAGetPropertyNames( objectRec As String, propertyNames() as String) As Integer
H&Ja9c|-ax0QZp0    Dim ret%
C` i9\.],u9RY+s0    Dim sList as Variant51Testing软件测试网(}'E+\a9@V!P(Qa
    ret = SQAGetPropertyList( objectRec, sList)51Testing软件测试网UA a Z W
    If ret <> sqaSuccess Then51Testing软件测试网B6\Y;\#Q
        SQAGetPropertyNames = ret
[] f"xTICrjd0        Exit Function51Testing软件测试网3`x:| rj"G|
    End If
0|GY\ cZ"vo&W0    51Testing软件测试网fkM+Lh"y
    Dim cObj%
h&f{/M B&C}0    cObj = SQAGetListCount( sList )51Testing软件测试网6NS^ _d f%f-D
    ReDim propertyNames( 0 To cObj-1 )51Testing软件测试网,y'? p_%w

S5^4]%uk0    Dim i%
2g i"}| P0    Dim vName as Variant
lR r0h0ss0    For i = 0 to cObj-151Testing软件测试网9Pm4zl0vC-c!z#Zq
        ret = SQAGetListItem( sList, i, vName)
7MD3R;vtN:PoQ0        If ret <> sqaSuccess Then
~\"B!O]I8~ k)S0            SQAGetPropertyNames = ret51Testing软件测试网5u2M)N0DM7T7Xj @8eL
            Exit Function
%P/y LttZQ0        End If
Je&v7vWoy0O6P0        propertyNames(i) = vName51Testing软件测试网c J _$o!V/x2l$c T h
    Next i
'r^O g6M6~lO8zI0
7\ |\M-FmJo0    SQAGetPropertyNames = sqaSuccess51Testing软件测试网 V9\`'U'Sn;\

$\/m*E.N(gm9D0End Function
;Z;EJ1KJ_0' ----------------------------------------------------------------------------51Testing软件测试网D-WNJ1O
Function SQAGetChildren( objectRec As String, childRec() as String) As Integer
*^`|d[z R0    Dim ret%51Testing软件测试网4hN#P MVaL
    Dim sList as Variant51Testing软件测试网%T \ q9{Rc ?
    Dim parentPrefix as Variant51Testing软件测试网-@b aLK?\k
   
u+TH*b3Jy1LP0    ret = SQAGetProperty( objectRec, "FullRecognition", parentPrefix )
#n:eoK`3iC*{0    If ret <> sqaSuccess Then
9~2Wp/A/i3X,F}0        SQAGetChildren = ret
-Y Vpp/{Y0Z,Vd0        Exit Function51Testing软件测试网 Y/PsU ^
    End If
Q&`*P"^ xC0        parentPrefix = parentPrefix + ";\;"
cBuSpQ"y2sS(K/_0   
$tz v[[L p0    ret = SQAGetChildList( objectRec, sList)51Testing软件测试网m?!bL9|1{?+|
    If ret <> sqaSuccess Then
em0O A `?4?X0        SQAGetChildren = ret
,A2U'O&~X2WA v$f)E0        Exit Function51Testing软件测试网LfWui&v
    End If51Testing软件测试网 TW P^ E.X.O
  51Testing软件测试网)V:zl H9P9HA
    Dim cObj%51Testing软件测试网 PJ+~U!wK3{
    cObj = SQAGetListCount( sList )
Iuj1{!P8Uv+p A0    ReDim childRec( 0 To cObj-1 )51Testing软件测试网FF;kr;H p
51Testing软件测试网m@5ToFg-E?
    Dim i%
h)Vlx1k}l0    Dim vName as Variant51Testing软件测试网"zE(pn+ILR Y|SR
    For i = 0 to cObj-151Testing软件测试网8`)oU/]3[&u%gqg8q*v$J
        ret = SQAGetListItem( sList, i, vName)
HSI`,E5r0        If ret <> sqaSuccess Then51Testing软件测试网[J9I8YQALg
            SQAGetChildren = ret51Testing软件测试网7]r_|so
            Exit Function
\ ORN.B y[4o0        End If
gfD H| P5P@2W*`$[0        childRec(i) = parentPrefix + vName51Testing软件测试网mYmA3U%dy
    Next i
(q Q,s2_^%[o]M3Y0
2@ LA&Y'I&e0    SQAGetChildren = sqaSuccess51Testing软件测试网b1|Qx6_W`%NW

n&d TQ ]hhc'N8[0End Function51Testing软件测试网V2L0W5h#|8G5O vrG
' ----------------------------------------------------------------------------
?dA!l2Bo0W.Q3iX0Function SQAGetPropertyArrayAsString( objectRec As String, propertyName as String, propertyValues() as String) As Integer51Testing软件测试网be.S5B*q-s3Q
51Testing软件测试网N7F)IejZ}
    Dim ret%51Testing软件测试网'vO s.J#Q0NYk
    Dim val$51Testing软件测试网H%`vb;j
    Dim i%, p_sub_i$
d f-?.F@5q0Tn~0    Dim cProp%51Testing软件测试网QWxh$UL'J+lk
51Testing软件测试网MMBS"j9V
    ret = SQAGetPropertyArraySize( objectRec, propertyName, cProp )51Testing软件测试网+[j^%U-x
    If ret <> sqaSuccess Then51Testing软件测试网 k4yP'T i(E
        SQAGetPropertyArrayAsString = ret
7}n[,ukT;O0        Exit Function
@ A0B }H0    End If51Testing软件测试网6o#|q m;m^{n

t8] ?(s ] } b7} `0R0    ReDim Preserve propertyValues( 0 To cProp-1 )
%[@#g%x V+B_C0   
@1ix*g8A0    For i = 0 to cProp-151Testing软件测试网(Y.D/jt#F A5e
        p_sub_i = propertyName+"("+str(i)+")"
Q X m:Xj"Z)J)n3HWs0       
Adn,fjC0        ret = SQAGetPropertyAsString( objectRec, p_sub_i, val)
D N$WHo?Y6hw0        If ret <> sqaSuccess Then
/nlv |Ug ~:u0            SQAGetPropertyArrayAsString = ret
?:F/}_Lqsxva!E0            Exit Function51Testing软件测试网5X ao/wbN:J?
        End If51Testing软件测试网8I+tp?4ntBa
        propertyValues(i) = val
|/yO+I.pu*yzpY"q0       51Testing软件测试网UrLZ"d DF+r
    Next i       
O~s*K'py|0   51Testing软件测试网-p#nbC*_Bu#\x
    SQAGetPropertyArrayAsString = sqaSuccess51Testing软件测试网u%Q,K7V,o

Tg0Jo5Bi {0End Function
)`E,Mx ZF0' ----------------------------------------------------------------------------51Testing软件测试网(zQ']%FE-t8o
Function SQAGetPropertyArray( objectRec As String, propertyName as String, propertyValues() as Variant) As Integer51Testing软件测试网h,B9hh,g

&Lq:f c[dJ0    Dim ret%
Sj8N+nVHn4b*f A0    Dim val as Variant
Sm3ahh0W:@I2L0    Dim i%, p_sub_i$
O/B0O.y o{ X&o't0    Dim cProp%
.m7F/tB A;L3y051Testing软件测试网u)m2rq.pD!h
    ret = SQAGetPropertyArraySize( objectRec, propertyName, cProp )51Testing软件测试网*Cg"]%c'^K#L-k)g
    If ret <> sqaSuccess Then51Testing软件测试网4kDd8t/E
        SQAGetPropertyArray = ret
Bjn!gKW%[&gX)K0c0        Exit Function
,^.hr5j]P0    End If
pBX6R1^R lf6n051Testing软件测试网5b$q2J ?p
    If cProp>0 then51Testing软件测试网(P F)fNu:g@
        ReDim propertyValues( 0 To cProp-1 )51Testing软件测试网5]?|2_A~FV
    End if
M`)H#WS*~"s0
.\WkEAw3o/[0    For i = 0 to cProp-151Testing软件测试网Q?*p$[oz N j4M
        p_sub_i = propertyName+"("+str(i)+")"
uNI i!`#p0       51Testing软件测试网9@!o0w)Uv e
        ret = SQAGetProperty( objectRec, p_sub_i, val)
0N| V[(h n&Hrqr0        If ret <> sqaSuccess Then51Testing软件测试网`8c!TT*]"~ YB
            SQAGetPropertyArray = ret
qw#|~L$kF0            Exit Function51Testing软件测试网4j$Ze#[E.` H#XV\
        End If51Testing软件测试网']FI.M3C^^
        propertyValues(i) = val
Lz Kh,c_*~4N0       51Testing软件测试网%g5y(`td)J
    Next i       
NQ8t%o{ u Q6R n0   51Testing软件测试网qsE?J;{%O3R$L
    SQAGetPropertyArray = sqaSuccess51Testing软件测试网D A5}/U N-]~b-R A
51Testing软件测试网6m6W[r-JpD(WUa;u@'I
End Function
5j!WQ1[%|?w8P0' ----------------------------------------------------------------------------51Testing软件测试网 b!CoS*uEH
Function SQADatapoolOpen (pszDpName As String, Optional bWrap As Variant, Optional nSequence As Variant, Optional bExclusive As Variant) As Long51Testing软件测试网5yjNKF d
    Dim lResult As Long51Testing软件测试网d%dJ pjL F m`-\}
    Dim dwFlag As Long51Testing软件测试网]5XVf4w(c
    Dim lLength As Long51Testing软件测试网6` _}OT^
    Dim sErrText As String
t h+jB"wO,\ i"H0
7e1a4Qq1EX7z0    lResult = sqaDpSuccess51Testing软件测试网N7M"]4N t{G\E
    ' Set the optional parameters to defaults if missing51Testing软件测试网kI SB9c9w+p r0@M
    If IsMissing(bWrap) = -1 Then
.d7HT4`7t&V0        bWrap = false51Testing软件测试网Myy5q FC4x
    End If51Testing软件测试网7A7b`-hVq4N
    If IsMissing(nSequence) = -1 Then51Testing软件测试网] H"OC%y
        nSequence = SQA_DP_SEQUENTIAL51Testing软件测试网 [vhNJ
    End If51Testing软件测试网;KO'j$^%Kz
    If IsMissing(bExclusive) = -1 Then
y8W@Y@0        bExclusive = false
3|?!Me5@)k SO2u?,q0    End If
Awv#zi8B0
6N Sm,VH!q9b%j U,|0    ' Check if the optional parameter is correct type
c V@.mHz*[I0    If Not VarType(bWrap) = 2 And Not VarType(bWrap) = 3 Then51Testing软件测试网l+rT ]I0\-Zpt
        lResult = sqaDpInvalidArgument51Testing软件测试网 v+Cb+G8`3}6o
    End If
+k7Uy/ib a Y(Gg0    If Not VarType(nSequence) = 2 And Not VarType(nSequence) = 3 Then
(^9F;A,\f Q[0        lResult = sqaDpInvalidArgument51Testing软件测试网6AUen!K2_S.u
    End If51Testing软件测试网#OV_c&h
    If Not VarType(bExclusive) = 2 And Not VarType(bExclusive) = 3 Then51Testing软件测试网0R$k%U!}r
        lResult = sqaDpInvalidArgument51Testing软件测试网A WNg;P{!~U,Tm
    End If51Testing软件测试网 P(J@w(bO7k
   
X)N(UX}]p0    If lResult <> sqaSuccess Then
M+V9k&q8Q/M%CZ}:g%u0        SQADatapoolOpen = lResult51Testing软件测试网YS an7}6R8i#T2w8Y'l
        Exit Function51Testing软件测试网"we `w%_3h&W9T?Z5b}
    End If51Testing软件测试网[]!zO;JQy
       51Testing软件测试网2Ic4K#qv3w1H
    ' Build the dwFlag51Testing软件测试网g;v?!S[*A
    If bWrap Then
g;i/Th9MA*ev#wA0        dwFlag = SQA_DP_WRAP51Testing软件测试网 A:N(s3vU7]
    Else
j f aW'Fg0        dwFlag = SQA_DP_NOWRAP51Testing软件测试网 I k%s ~P
    End If51Testing软件测试网r8Fa!w/|S8G'z

(l`!df%~4D5{0    If nSequence = SQA_DP_RANDOM Then
h6Ta2Q e q0        dwFlag = dwFlag + SQA_DP_RANDOM
2j B'z(ZD%oX0    ElseIf nSequence = SQA_DP_SHUFFLE Then
rSbl2~0        dwFlag = dwFlag + SQA_DP_SHUFFLE
u7LW ptki*lH0    ElseIf nSequence = SQA_DP_SEQUENTIAL Then
EO h?'m-q#bL0        dwFlag = dwFlag + SQA_DP_SEQUENTIAL51Testing软件测试网'o+WrmFP(v#n;M
    Else51Testing软件测试网]h;Vu f&p0Q W
        SQADatapoolOpen = sqaDpInvalidArgument51Testing软件测试网)etu9d9rJxx A
        Exit Function51Testing软件测试网sxc\OlR5?2k;P
    End If51Testing软件测试网NxX gu.f

4hG"o_4f} CC0    If bExclusive Then51Testing软件测试网r6u:`;|:\o
        dwFlag = dwFlag + SQA_DP_PRIVATE51Testing软件测试网1[PB#D@#\7{
    Else
3o)q Z3x1`/o!k0        dwFlag = dwFlag + SQA_DP_SHARED51Testing软件测试网:E j0G&C_o
    End If   51Testing软件测试网UITm Ln/t+]@W
51Testing软件测试网RB!pAsQ
    lResult = LCSdatapool_open(pszDpName, dwFlag)51Testing软件测试网6a,TH_z X
    if lResult < 0 Then51Testing软件测试网l9x1t@txE6~%dg$a
        lLength = 16051Testing软件测试网0f9X k| ]`
        sErrText = space(lLength + 1)51Testing软件测试网+D q%a6_9t W
        lResult = TSSErrorDetail(sErrText, lLength)
ga&PR`d'`0        If lLength > 160 then51Testing软件测试网7cqU+n6ob
            sErrText = space(lLength + 1)51Testing软件测试网A3`jR p|oc
            lResult = TSSErrorDetail(sErrText, lLength)51Testing软件测试网0_JH-T]v@
        End If51Testing软件测试网X&H| |2NA:H
        SQAscrīptCmdFailure sErrText51Testing软件测试网%O$D%YZ^o#|
        SQADatapoolOpen = sqaDpFailure51Testing软件测试网z nP#Kis.L#QB%JrPJ
    Else51Testing软件测试网FAb-aS"C:KK8`!`&}
        SQADatapoolOpen = lResult
.?7^@%T2h QLoY0    End If
+d@WVNH0   51Testing软件测试网2|(uh6sO u [la
End Function51Testing软件测试网5]:~.S{8C
' ----------------------------------------------------------------------------51Testing软件测试网)A u ??!S
Function SQADatapoolValue (dpID As Long, dpCol As Variant, sValue As String) As Long51Testing软件测试网r/G:Y'z Q9O9G(B&Xz
    Dim lString As Long
\4|MK0W*]0    Dim lLength As Long
;F*E3r L:n5Q\X0    Dim lResult As Long51Testing软件测试网x~,Nws0v
   
3C-F7S@p#u`5ASH0    lString = 0
"F8EV"_+l0    lResult = sqaDpSuccess51Testing软件测试网m&Z7B*K-_
    If VarType(dpCol) = 2 Or VarType(dpCol) = 3 Then51Testing软件测试网`pdEl
        lString = LCSdatapool_position_value(dpID, dpCol)51Testing软件测试网_$txd(g(s1V0r;}
    ElseIf VarType(dpCol) = 8 Then
5O1G%R`i[0        lString = LCSdatapool_name_value(dpID, dpCol)51Testing软件测试网!fX!o7F`
    Else
W'@!c2r E#LRc0        SQADatapoolValue = sqaDpInvalidArgument51Testing软件测试网K'|K$HB Ou
        Exit Function51Testing软件测试网Du ep'wz
    End If
9_4w0R[]h#FN0
M-T^gO&]&fB#lc0    If (LCS_LAST_VALUE_ERROR <= lString) And (lString <= 0)  Then51Testing软件测试网0\ }^.E`,c+i5E
        sValue = ""
nRR.d/YP0        ' Preserve interesting errors
t(Od5T k*u?)Ij0        If lString <> 0 Then51Testing软件测试网)QX"M8C i
            SQADatapoolValue = sqaDpFailure
}:B.U.}oR-V'`0        End If
PDz}l.ju0    Else51Testing软件测试网 }t BiH%i+l
        lLength = Dplstrlen(lString)51Testing软件测试网` }?#NBJ-rJ(RS#OH
        sValue = space(lLength + 1)
?1c2I0HD"^!HI0        Dplstrcpy sValue, lString51Testing软件测试网9\5\7Pv\3]5W6iN
        sValue = Left$(sValue, InStr(sValue,Chr$(0)) - 1)51Testing软件测试网\3lN*Q,tH
    End If
v R(~{#} |;V M Bi0End Function51Testing软件测试网S(fU!U|b4c,J#^5bO
51Testing软件测试网/i1Hf br1{
'51Testing软件测试网-ao8`w~l7r
' Clean String - Cleans out HTML tags
UYQxE \ ^I0'
v W)f1\-Y1y0Function CleanString(TargetStr As String) As String51Testing软件测试网(h%zl4y!kY,[:a
51Testing软件测试网T$g1h#suK.E6F
Dim NewStr   As String51Testing软件测试网!t:li I"Fc.K4Q \(P
Dim Position As Integer
A3P i9j+Dp~2Y#x!K;p0
M;A xj-BL8@,Y0    Position = InStr(1, TargetStr, "<")51Testing软件测试网*Cp-lxZ5p!~Bo
    If (Position > 1) Then
3?3q/gI,rl"p0        CleanString = Mid$(TargetStr, 1, Position-1)
7F2Y @j0q:Lbt0    Else
PL[;W2\R}'uS0        CleanString = TargetStr
9l cuqC eV0    End If
fb\2c7v5Tk0
.k/cP CC%k0End Function51Testing软件测试网+W#s;LE5{ _4A

*Ky1iC*^0'=================================================================================
+uT:j*I$H&M'Q0' FindAndLogString --51Testing软件测试网 ?b!pe.G \9{!yL3@%apQ
'   Open a file to search and find all occurances of the string.  Log the results51Testing软件测试网"]/td^ x }
'   to the log file and close up when complete.51Testing软件测试网Nmz'O.],N,Ay
'=================================================================================
YB$ej"d2DrG0Function FindAndLogString(FileName as String, SearchText As String, LogEntryType As Integer) As Integer
X7xo3^V,@MR'd051Testing软件测试网] _ s7iZo n$Q2B
Dim SearchedStr, FoundStr As String51Testing软件测试网o%G7E ])ik5I$U*S
Dim Position As Integer51Testing软件测试网:yI;xg2{l"N{0}3H
Dim LineNumber As Long
:M!s6W?kFZ1I0Dim FileNumber As Integer
H Jl4JL1Q(g;AEU0   51Testing软件测试网 sc@O.nl&G!bN+p
On Error GoTo BailOut
MQ&f(t dY/X0
E1D z`]9d:oo,r0    FileNumber = FreeFile
4_"[pRZ["zY+C7F0    LineNumber = 051Testing软件测试网$B9L Z&s0If^{
    Open FileName for Input As #FileNumber
-I(p-Zb8z0G})U C0   
H3m{6U/L\Cm\7E0    Do Until EOF(1)51Testing软件测试网7i"r-I:m+Y2Z
        Input #FileNumber, SearchedStr51Testing软件测试网~W2`D8|/qrT:sG
       51Testing软件测试网 @7@-bg7D
    ' Increment the line counter51Testing软件测试网-s^W O"EU'x0\
        LineNumber = LineNumber + 151Testing软件测试网qc9])A7[7a
       
8q ?pft1f0    ' Search in the string for the desired text51Testing软件测试网w;X E#O0LnT@
        Position = InStr(1, SearchedStr, SearchText)
Y({'jP6R C5k+B3h*l0        If (Position <> 0) Then51Testing软件测试网 Dulw(|$?5tm3{;c
            FoundStr = Mid$(SearchedStr, Position)51Testing软件测试网TA6o#j3x4W-C6l
            SQALogMessage LogEntryType, CleanString(FoundStr), "Found at line: " & LineNumber & " in: " & FileName
9?4\8^X/u0        End If      
6Pi)HA5ca0t!JF0    Loop
o c6{p{o0
(}Y3q6A6b&{0    Close #FileNumber
&H.F"pdN0W:Ov[4A0\0
J6s%^"r5r(I0Exit Function   51Testing软件测试网UgCQ&t
   
E I\8qL+]0BailOut:51Testing软件测试网m1@a&rmw2l/ut)[)}I
   
LS-p+t o~6WLx;e#e0    MsgBox "Error " & Err & ": " & Error$51Testing软件测试网t(mH:G+GieHt H
    SQALogMessage SQAFail, Err & ": " & Error$, "File Error"51Testing软件测试网w%i @!i?-n y#O
   51Testing软件测试网*z[%P)?I4]
End Function51Testing软件测试网x'y%vlL

iI*X.CU?+A0' ----------------------------------------------------------------------------51Testing软件测试网3}5QR `9j*]c|
'---------------------------------------------------------------------------------
*PV/mtb0' SQACreateBaseline() -- Call the install analyzer to create a baseline snapshot
Z0}"\cBk+Y&N%q0'---------------------------------------------------------------------------------
U#s{h-H(Q f0Function SQAEnvCreateBaseline(fileName as String) As Integer
Xb/Vec9E7SM051Testing软件测试网:@%gz/K$m
    Dim FullPath, CommandStr as String51Testing软件测试网Wv!iAc;l6xN3Tf
    Dim ToolRoot, LogRoot As String
;zkAy5APo0    Dim Result as Integer51Testing软件测试网u@8f1wXG{%PgYJ
   
*t$@2jO~0' Get the target directories51Testing软件测试网V"wl3k ~ q
    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)
]Q h3z |0    LogRoot = SQAGetLogDir51Testing软件测试网-x0X:_4b w K:DM3dK)x
   51Testing软件测试网(HZ |T*Ke
    SQAEnvCreateBaseline = 051Testing软件测试网"u(b?n`f.p
   
1mBym~6B!Lz4A0    FullPath = LogRoot & "Results\" & fileName & ".ans"51Testing软件测试网 q,Xf1G;Y d
    CommandStr = ToolRoot & "Analyzer /nologo /bc:" & fileName & " /res:" & LogRoot & "Results\"51Testing软件测试网 H5Nadxw+x(Le[

UU:E2g V0On Error Resume Next51Testing软件测试网%TNv$~!L
    Kill FullPath
Vcz z_O:h9A0   51Testing软件测试网&j5blB(`,df/G~ A1B
' Turn off logging, there's no need to see the file VP in the final log file    
*Fw&F&Q6}i:F0    SQASuspendLogOutput
g'^vV5Z%r051Testing软件测试网$O,E9Ly6Bq d~Ox:j
' Execute the command   51Testing软件测试网l:Z? W eJ3p)FHN[
    Shell CommandStr, 151Testing软件测试网 @VQ~EO/wn
   
0o$ar'W(vV-K0    FullPath = "Name=" & FullPath51Testing软件测试网3R-H#c.O(_U!h"iyB
    Result = FileVP(Exists, FullPath, "VP=Baseline Analyzer File;ExpectedResult=PASS;Wait=10,1200")51Testing软件测试网8M&gK mgR

C B}E[#mQ0' Turn the logfile back on51Testing软件测试网UmbS^!C _2^R;hYs
    SQAResumeLogOutput51Testing软件测试网"]kr LQ(U

W"J!]8H2}9JrU)Wz^0' Grab and close the Analyzer Window
1@H?#l({p'v0    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""51Testing软件测试网r8wj F^
    Window CloseWin, "", ""51Testing软件测试网%Lr To2g$OP:CU
51Testing软件测试网p HC&M Q
    SQAEnvCreateBaseline = Result
wJN8S Z1I i4Gv'j0   
.`(G~_ogJ0End Function
ln"v9R C aau KX5S6S051Testing软件测试网A!r2C!pko
'-------------------------------------------------------------------------------
)p1Q"y4S1f"y,N(J0' SQAEnvCreateCurrent() -- Call the install analyzer to create a current snapshot
v;RP1B@;|8WF0'-------------------------------------------------------------------------------51Testing软件测试网 q#[;yh?I
Function SQAEnvCreateCurrent(fileName as String) As Integer51Testing软件测试网e|4MbVvl2M` T
    Dim FullPath, CommandStr as String
)s$F F L%Q U t q0    Dim ToolRoot, LogRoot As String
(? B.R'WFj0    Dim Result as Integer
:W5t/vBd:E8thK0   
|0QX6sB*I:N0' Get the target directories51Testing软件测试网m;f"r(]mq@`4jW(\
    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)
E.y/t$S3I3z P{0    LogRoot = SQAGetLogDir
4m:rn-tEUg k+Y0   
~ UEd:QRhQ0    SQAEnvCreateCurrent = 051Testing软件测试网VH [0z1_wmZ

$cdW#v8f;SY0    FullPath = LogRoot & "Results\" & fileName & ".ans"51Testing软件测试网~4f"p%GNT_f w lJ
    CommandStr = ToolRoot & "Analyzer /nologo /cc:" & fileName & " /res:" & LogRoot & "Results\"
fFb]pAy2^ b0        51Testing软件测试网H | Q/[E;X(D2T-r
On Error Resume Next51Testing软件测试网,Pj c MVZX5CU!a
    Kill FullPath
-zYWY8ly0   
'k F8o M,?0' Turn off logging, there's no need to see the file VP in the final log file    
#})s;C ?o)n0    SQASuspendLogOutput
g#TE_gF0
^-i8e]DXZl0' Execute the Command51Testing软件测试网#Y~J U(v3k
    Shell CommandStr, 1
g$D!X$]1?2G8Q0   
TU{X/] o#b)L0    FullPath = "Name=" & FullPath51Testing软件测试网~4r;Bsg+K8d:m
    Result = FileVP(Exists, FullPath, "VP=Current Analyzer File;ExpectedResult=PASS;Wait=10,1200")
]1U.r*p r3A/| t _051Testing软件测试网g_8j.[2w/H)C6{I3A
' Turn the logfile back on51Testing软件测试网:TXjk(o@ ?.?9n
    SQAResumeLogOutput
3e"Y QY/O(S^gv0
/M1ql,Q;nB [$N h0' Grab and close the Analyzer Window51Testing软件测试网/?0]A5l3ax*|y3G0VVw
    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""51Testing软件测试网RzXv/u6lQ9p
    Window CloseWin, "", ""51Testing软件测试网4\P[X%_u^+` e$lI}

.BeS9~9bDY/_0    SQAEnvCreateCurrent = Result
$W ` { N"K&p"? d0   
}:]px k)u0End Function
T%`[nWWvjn0
O,x#K!iE8[A9C0'-------------------------------------------------------------------------------
$d,eW$d(L6w_zv0' SQAEnvCreateDelta() -- Call the install analyzer to create a current delta report
.k(iA"Lw$q5yhZ)\0'-------------------------------------------------------------------------------51Testing软件测试网:@:l|r@Lo
Function SQAEnvCreateDelta(Baseline as String, Current as String, ShowReport As Integer) As Integer51Testing软件测试网Pcv*jsXc,[:z:R

|/d t(a9K*W4I0    Dim FullPath, CommandStr, ErrorPath,SearchedStr, FoundStr As String
xlt:^EY,A0    Dim Position As Integer
M9p|@F?[0    Dim ToolRoot, LogRoot As String51Testing软件测试网 B(G}-F9{ t9O
    Dim Result as Integer
9Y2?tCY e)^ ^0
8Q7b0T A1a!}U"Nl0    SQAEnvCreateDelta = 0
h@,Ji"auE g7nv0       
yY/dFeEoH"d0' Get the target directories51Testing软件测试网ox"QTw{
    ToolRoot = SQAGetDir(SQA_DIR_RUNFILES)
"ANy y4} u0    LogRoot = SQAGetLogDir
&iE4s7X ^2@0
)sJ ~ CYo,H0    FullPath = LogRoot & "Results\" & Current & " - " & Baseline & ".htm"51Testing软件测试网:Hy2HpZ l
    CommandStr = ToolRoot & "Analyzer /g /nologo /bl:" & Baseline & " /cl:" & Current
p _u_J`1l ]*uX/R0   51Testing软件测试网3oZ:o-|_
'51Testing软件测试网Dn \a ?;H
' PHJ - 17-Jan-2000
S iL Z!q0'  Commented out and moved the ShowReport functionality to the bottom
Xv r s.k0'    If( ShowReport = 0 ) Then
1h,B,c s8\:B0'        CommandStr = ToolRoot & "Analyzer /g /nologo /bl:" & Baseline & " /cl:" & Current  & " /res:" & LogRoot & "Results\"
(Vo0fD)H!Z6C&^?0'    Else51Testing软件测试网 t&gY#K ^1m6IF4d.D5o
'        CommandStr = ToolRoot & "Analyzer /gu /nologo /bl:" & Baseline & " /cl:" & Current & " /res:" & LogRoot & "Results\"
dR+j J(u?0'    End If51Testing软件测试网7Zx+e Z%U+E)B`-q'tV

Qg#?PZ0A]X0On Error Resume Next   
;h x'E }8Rv0    Kill FullPath51Testing软件测试网"NYum nw6{x

$B] V6w7D p0rsg ~0' Turn off logging, there's no need to see the file VP in the final log file    
6e5k @}(KI0    SQASuspendLogOutput51Testing软件测试网/Y u,MMjYj&P2zu E
 51Testing软件测试网$ccS&~%t^#n t%v:rG
' Generate the Deltas and wait for the file to be available51Testing软件测试网mF ZY1JZ
    Shell CommandStr, 1
v4{ x"F7E+c7V fG0    CommandStr = "Name=" & FullPath
4e F(Wji _ W(Y0    Result = FileVP(Exists, CommandStr, "VP=Create Delta Report;ExpectedResult=PASS;Wait=10,1200")
v6[S2Z"V`5wuT.HF0
"B7X,F*R*]\ J8z0' Turn the logfile back on51Testing软件测试网7^9AM+g/}0J$W
    SQAResumeLogOutput51Testing软件测试网gQ!Yql!t p_x

8zz`)knA$?0' Grab and close the Analyzer Window51Testing软件测试网^{$IL8P `e
    Window SetContext, "Caption={VeriTest-Rational Install Analyzer - *}", ""51Testing软件测试网4Amf js md3^*m"m2R
    Window CloseWin, "", ""
&c&m NEqe,N+NC051Testing软件测试网4hZGl vk'?"Z;O
' Grep for Changes in the delta file -- Grep needs quotes around filenames with spaces51Testing软件测试网5db8T#gn$|0j
   FullPath = LogRoot & ".\Results\" & Current & " - " & Baseline & ".htm"
~^(hI{8|0TQ2Lo0
%{e _SR0oI/`0   FindAndLogString FullPath, "WARNING", SQAWarning51Testing软件测试网S2]c%x6n1mf
   FindAndLogString FullPath, "ERROR",   SQAFail51Testing软件测试网"u Wbx.QU+v2s R L6G
   FindAndLogString FullPath, "INFO",    SQANone
4{ ]jU c^J0
(wopg3Gt-[s0'
/E"mY|r0' PHJ - 17-Jan-200051Testing软件测试网W5W2VGW0mv
' If the ShowReport flag is thrown, start a browser with the new file51Testing软件测试网(xh*K.?5_&c8Y!Qv
'
-}%RH \Fkq-VU0   If( ShowReport = 1 ) THen51Testing软件测试网2zvVZQ
        StartBrowser FullPath, ""
3H/d0\_;C [,A0   End If
']1NZj?q051Testing软件测试网b!]oWL
    SQAEnvCreateDelta = Result51Testing软件测试网/Jz_.fnT J
      51Testing软件测试网9U4BSwl ].]'cf
Exit Function
T xS-Z2l2]V0
b5d zF-}7C.gia#o0CatchError:
%Db0zA'~4o W051Testing软件测试网 dL8{J.k#wM8TM
    MsgBox "Error " & Err & ": " & Error$
9s/\{e:JrD0    SQALogMessage SQAFail, Err & ": " & Error$, "File Error"51Testing软件测试网7VUV0Mw"@y&G}
       
6I5LK;n*}Go$~0End Function51Testing软件测试网q&t)CV\W

TAG: 软件测试技术 Robot技术

 

评分:0

我来说两句

Open Toolbar