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
'列出用例,输出用例数量及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作者: kavensyw 时间: 2010-10-28 16:11 本帖最后由 kavensyw 于 2010-10-28 16:15 编辑