If TDC.Connected Then
TDC.intConnectionEx qcServer
TDC.Login qcUser,qcPassword
TDC.Connect qcDomain,qcProject
Else
TDC.Disconnect
TDC.Logout
TDC.ReleaseConnection
TDC.intConnectionEx qcServer
TDC.Login qcUser,qcPassword
TDC.Connect qcDomain,qcProject
End If
'声明测试集树、路径、测试实验室、测试集名等对象
Set tsTreeMgr = TDC.TestSetTreeManager
Set tsFolder = tsTreeMgr.NodeByPath("Root\"&Trim(tsFolderName))
Set tsList = tsFolder.FindTestSets(tSetName)
'对测试集路径进行正确性判断,发生异常情况清空所有对象退出运行
If tsFolder Is Nothing Then
Wshshell.Popup "找不到指定路径【"&nPath&"】",1,"运行时错误:",0
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTreeMgr = Nothing
Set TDC = Nothing
Set Wshshell = Nothing
Exit Sub
End If
If tsList.Count > 1 Then
Wshshell.Popup "同名测试集多于一个,请先删除多于测试集!【"&nPath&tSetName&"】",1,"运行时错误:",0
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTreeMgr = Nothing
Set TDC = Nothing
Set Wshshell = Nothing
Exit Sub
ElseIf tsList.Count < 1 Then
Wshshell.Popup "找不到测试集!【"&nPath&tSetName&"】",1,"运行时错误:",0
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTreeMgr = Nothing
Set TDC = Nothing
Set Wshshell = Nothing
Exit Sub
End If
If Trim(runMode) = "localrun" Then
Set Scheduler = theTestSet.StartExecution(LocalHost)
Scheduler.RunAllLocally = True
Scheduler.Run
ElseIf Trim(runMode) = "remoterun" Then
Set Scheduler = theTestSet.StartExecution(LocalHost)
Scheduler.TdHostName = runHostName
Scheduler.Run
Else
Wshshell.Popup "调用接口错误,无此运行选项:【"&runMode&"】",1,"运行时错误:",0
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTreeMgr = Nothing
Set TDC = Nothing
Set Wshshell = Nothing Exit Sub
End If
Set TestSetTestsList = Nothing
Set TSTestFact = Nothing
Set theTestSet = Nothing
Set tsList = Nothing
Set tsFolder = Nothing
Set tsTreeMgr = Nothing
Set Wshshell = Nothing
Set TDC = Nothing