Deleting test sets through API

Question ID: 106966
0
0

Every now and again we get a test set that has too many steps or a corrupted step and is not able to be viewed or deleted in the application. We have previously been having our DBA remove these. Is there a way to remove these test sets using API in order to avoid DBA involvement?

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on July 15, 2016 9:16 pm
9 views
Answers (1)
0
Private answer

You can delete test sets from the API using the TestSet Factory Object and the RemoveItem method. Below is an example:

On Error Resume Next

Dim qcServer, qcDomain, qcProject, qcUser, qcPassword

'Define variable values for QC connection
qcServer = ''http://qc:8080/qcbin/''
qcDomain = ''DEFAULT''
qcProject = ''ALM_DEMO''
qcUser = ''alex_alm''
qcPassword = ''''

'Create the TD Connection object
Set tdc = CreateObject(''tdapiole80.tdconnection'')

'Establish the connection and log in to the project
tdc.InitConnectionEx qcServer
tdc.Login qcUser, qcPassword
tdc.Connect qcDomain, qcProject

'If connection is established
If tdc.Connected = True Then

'Get the TestSetFactory object
Set TSFact = tdc.TestSetFactory
'Remove the TestSet by ID
TSFact.RemoveItem(30)
'Report any errors
If Err.Number <> 0 Then
MsgBox Err.Number & '' : '' & Err.Description
End If
'Kill the TestSetFactory object
Set TSFact = Nothing
End If
'Disconnect from the project and logout of QC
tdc.Disconnect
tdc.Logout

'Kill the TDConnection object
Set tdc = Nothing

On Error Goto 0

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on July 15, 2016 9:16 pm