Code to assign a defect to MANY test instances at one time
Question ID: 107061
0
0

We have run a Test Set where a few hundred test instances were supposed to be linked to a primary defect but were not. We are now having to go back and link these. Does anyone know of a faster route than manually updating each one? Is there possibly some workflow code that I can run?

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on August 12, 2016 6:34 pm
52 views
Answers (1)
0
Private answer

You can uses this code as an example as to how this could be done using Workflow / API. This can be assigned to a toolbar button in the Test Lab and called from the ActionCanExecute trigger.

If ActionName = ''AddBug'' Then
Set TestSetFilter = TDConnection.TestSetFactory.Filter
TestSetFilter.Filter(''CY_CYCLE'') = ''''''Mercury Tours Functionality''''''
Set TestSetList = TestSetFilter.NewList()

For Each TestSet in TestSetList

Set TestSetObj = TDConnection.TestSetFactory.Item(TestSet.ID)
Set TSTestFilter = TestSetObj.TSTestFactory.Filter
TSTestFilter.Filter(''TC_STATUS'') = ''Failed''
Set TSTestList = TSTestFilter.NewList()

For Each TestInst in TSTestList
Set BugLinkFact = TestInst.BugLinkFactory
BugLinkFact.AddItem(40) 'SET BUG ID FOR THE LINK HERE
Set BugLinkFact = Nothing
Next

Set TSTestList = Nothing
Set TSTestFilter = Nothing
Set TestSetObj = Nothing

Next

Set TestSetList = Nothing
Set TestSetFilter = Nothing
End If

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on August 12, 2016 6:36 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top