TA的每日心情 | 开心 2015-10-19 13:26 |
---|
签到天数: 2 天 连续签到: 2 天 [LV.1]测试小兵
|
本帖最后由 kavensyw 于 2010-10-28 16:17 编辑
Dim tdc 'TDConnection Object
Dim tFact 'TestFactory Object
Dim TestFilter 'Filter Object
Dim TestList 'List Object
Set tdc = CreateObject("TDApiOle80.TDConnection.1")
'初始化
tdc.InitConnectionEx HostName '服务器地址
'登录
tdc.Login UserName,Password '用户名,密码
'连接
tdc.Connect Domain, Project '域名,项目
If tdc.Connected And tdc.LoggedIn Then
MsgBox "Connected and Login Success!"
End If
Set tfact = tdc.TestFactory
Set TestFilter = tfact.Filter
'使用Filter
'Filter的字符串不能有空格吗?
'在QC中把文件夹和用例名中间有空格,不能正常运行
'TestFilter.Filter("TS_NAME") = "Check Style"
'SubjectPath ="Functional\Report\Coverage Report\All Distributors"
'在QC中把文件夹和用例名空格都去掉后,不带空格能正常运行
TestFilter.Filter("TS_NAME") = "CheckStyle" '用例名
SubjectPath ="Functional\Report\CoverageReport\AllDistributors" '用例所在文件夹路径
TestFilter.Filter("TS_SUBJECT") = "Subject\"&SubjectPath
'列出用例,输出用例数量及ID
Set TestList = tfact.NewList(TestFilter.Text)
If TestList.Count <> 0 Then
MsgBox TestList.Count '
Set theCoverTest = TestList.Item(1)
idx = theCoverTest.ID
MsgBox idx
End If
'断开连接
If tdc.Connected Then
tdc.Disconnect
End If
'注销登录
If tdc.LoggedIn Then
tdc.Logout
End If
'释放对象
tdc.ReleaseConnection
Set tdc = Nothing |
|