' Input - TestSet Name in QC
sFolder = "Root\Automation"
sTestSetName = "TestSet1"
'Variable declaration
Dim oTestDirObj
Dim sQCServer
sQCServer = "http://xxxxxx/qcbin"
sQcUser = "UserName"
sQcPassword = "Password"
sQcDomain = "Domain"
sQcProject = "ProjectName"
'Define the connection object
Set oTestDirObj = CreateObject("TDApiOle80.TDConnection")
oTestDirObj.InitConnectionEx sQCServer
oTestDirObj.Login sQcUser, sQcPassword
oTestDirObj.Connect sQcDomain, sQcProject
'Navigate to the folder containing the test set.
Set oTstFact = oTestDirObj.TestSetFactory
Set oTstMgr = oTestDirObj.TestSetTreeManager
Set oTestFolder = oTstMgr.NodeByPath(sFolder)
'selecting a particular testset in the folder
set oTstSetFilter = oTestFolder.TestSetFactory.Filter
set oTstList = oTstSetFilter.NewList()
For i = 1 To oTstList.Count
If Trim(oTstList.Item(i).Name) = Trim(sTestSetName)Then
Set oListTstSet = oTstList.Item(i)
Exit For
Else
' MsgBox "Testset not found"
End If
Next
Set oListTstSetFilter = oListTstSet.TSTestFactory.Filter
Set oTestCase = oListTstSetFilter.NewList()
For testcasenum = 1 To oTestCase.count
set oTstRunObj = oTestCase(testcasenum).RunFactory
'Retrieve the run list object
Set oRunFil = oTstRunObj.Filter
Set oRunList = oRunFil.NewList()
If oRunList.Count > 2 Or oRunList.Count = 2 Then
For runnum = 1 To oRunList.Count-1
Set oRunObj = oRunList.Item(runnum)
oTstRunObj.RemoveItem oRunObj
'Post results
oRunObj.Post
Next
End If
Next
'Closing the TD connection
oTestDirObj.Disconnect
If oTestDirObj.LoggedIn Then
oTestDirObj.Logout
End If
oTestDirObj.releaseConnection
sFolder = "Root\Automation"
sTestSetName = "TestSet1"
'Variable declaration
Dim oTestDirObj
Dim sQCServer
sQCServer = "http://xxxxxx/qcbin"
sQcUser = "UserName"
sQcPassword = "Password"
sQcDomain = "Domain"
sQcProject = "ProjectName"
'Define the connection object
Set oTestDirObj = CreateObject("TDApiOle80.TDConnection")
oTestDirObj.InitConnectionEx sQCServer
oTestDirObj.Login sQcUser, sQcPassword
oTestDirObj.Connect sQcDomain, sQcProject
'Navigate to the folder containing the test set.
Set oTstFact = oTestDirObj.TestSetFactory
Set oTstMgr = oTestDirObj.TestSetTreeManager
Set oTestFolder = oTstMgr.NodeByPath(sFolder)
'selecting a particular testset in the folder
set oTstSetFilter = oTestFolder.TestSetFactory.Filter
set oTstList = oTstSetFilter.NewList()
For i = 1 To oTstList.Count
If Trim(oTstList.Item(i).Name) = Trim(sTestSetName)Then
Set oListTstSet = oTstList.Item(i)
Exit For
Else
' MsgBox "Testset not found"
End If
Next
Set oListTstSetFilter = oListTstSet.TSTestFactory.Filter
Set oTestCase = oListTstSetFilter.NewList()
For testcasenum = 1 To oTestCase.count
set oTstRunObj = oTestCase(testcasenum).RunFactory
'Retrieve the run list object
Set oRunFil = oTstRunObj.Filter
Set oRunList = oRunFil.NewList()
If oRunList.Count > 2 Or oRunList.Count = 2 Then
For runnum = 1 To oRunList.Count-1
Set oRunObj = oRunList.Item(runnum)
oTstRunObj.RemoveItem oRunObj
'Post results
oRunObj.Post
Next
End If
Next
'Closing the TD connection
oTestDirObj.Disconnect
If oTestDirObj.LoggedIn Then
oTestDirObj.Logout
End If
oTestDirObj.releaseConnection
No comments:
Post a Comment