Quality Center 10 test instance defect linkage

  • Questions
  • Quality Center 10 test instance defect linkage
Question ID: 104611
3
0

We are running QC 10.
We are raising defects while manually running tests, which automatically links the defect to the run and the test step. However it does not automatically link it to the test instance.
We want to be able to link it to the test instance.
Or at least display the link icon in the list of test instances.

I’m suspecting we would have to come up with script workflow code to accomplish this.
None of the examples show how I could do this.

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on September 23, 2012 9:07 pm
72 views
Answers (5)
4
Private answer

I have figured out how to do it automatically:

Add this code to the 'ActionCanExecute' function:

If Actionname = ''act_run'' Then
Set us = TDConnection.UserSettings
us.Open ''MySettings''
us.Value(''LastTestInstanceID'') = TestSetTest_Fields(''TC_TESTCYCL_ID'').Value
us.Close
us.Post
Set us = Nothing
End If
If Actionname = ''act_end_run'' or ActionName = ''RfrshAct'' Then
Set us = TDConnection.UserSettings
us.Open ''MySettings''
us.DeleteValue ''LastTestInstanceID''
us.Close
End If

Add this code to the Bug_AfterPost function:

Set us = TDConnection.UserSettings
us.Open ''MySettings''
lTestInstanceId = us.Value(''LastTestInstanceID'')
BugID = Bug_Fields(''BG_BUG_ID'').Value
us.Close

if lTestInstanceId <> '''' then

Set td = TDConnection
Set objTCtestFac = td.TSTestFactory
Set ojbTCtest = objTCtestFac.Item(lTestInstanceId)
Set objBugLinkFac = ojbTCtest.BugLinkFactory
Set objLink = objBugLinkFac.AddItem(BugID)
objLink.LinkType = ''Related''
objLink.Post
End If
Set us = Nothing

This will automatically link any defect you raise while running a test to the test INSTANCE.
Note that this may skew defect reports as it will say there are two linkages, one to the instance and another to the step/run.

Marked as spam
Posted by (Questions: 2, Answers: 1)
Answered on September 27, 2012 6:08 pm
1
Private answer

hi,

using this :
us.Value(''LastTestInstanceID'') = TestSetTest_Fields(''TC_TESTCYCL_ID'').Value,
you will always get the value of the test in testset that was selected when you clicked on 'run test' or 'run test set' button.

i suggest you use this instead :
us.Value(''LastTestInstanceID'') = Run_Fields(''RN_TESTCYCL_ID'').Value

best regards,
Maximilien.

Marked as spam
Posted by (Questions: 0, Answers: 9)
Answered on October 10, 2013 2:40 pm
1
Private answer

I tweaked the code to work for newer versions of ALM including ALM 12.50 and ALM 12.53, I also included the revision to use the Run_Fields(''RN_TESTCYCL_ID'').Value vs the TestSetTest_Fields(''TC_TESTCYCL_ID'').Value

'Put this in ActionCanExecute

if actionname = ''StepsView.NewDefect'' then
Set us = TDConnection.UserSettings
us.Open ''MySettings''
us.Value(''LastTestInstanceID'') = Run_Fields.Field(''RN_TESTCYCL_ID'').Value
us.Close
us.Post
Set us = Nothing
End If
If Actionname = ''act_end_run'' or ActionName = ''RfrshAct'' Then
Set us = TDConnection.UserSettings
us.Open ''MySettings''
us.DeleteValue ''LastTestInstanceID''
us.Close
End If

'Put this in Bug_AfterPost

Set us = TDConnection.UserSettings
us.Open ''MySettings''
lTestInstanceId = us.Value(''LastTestInstanceID'')
BugID = Bug_Fields(''BG_BUG_ID'').Value
us.Close

if lTestInstanceId <> '''' then

Set td = TDConnection
Set objTCtestFac = td.TSTestFactory
Set ojbTCtest = objTCtestFac.Item(lTestInstanceId)
Set objBugLinkFac = ojbTCtest.BugLinkFactory
Set objLink = objBugLinkFac.AddItem(BugID)
objLink.LinkType = ''Related''
objLink.Post
End If
Set us = Nothing

Marked as spam
Posted by (Questions: 0, Answers: 365)
Answered on June 6, 2017 4:27 pm
0
Private answer

1. Double click or Right-Click the test instance
2. go to ''Test Instance Properties'' > ''Linkage and Coverage''
3. Defects can be linked in the ''Linked Defects'' tab

You can also backtrack and link from the Defect to the Test Instance, but the method above is easier in my opinion.

Marked as spam
Posted by (Questions: 0, Answers: 3)
Answered on September 27, 2012 3:12 pm
Thanks for answering, but I probably didn't explain it clearly. I was looking for an automated method of doing it. I have figured it out and detailed it in another answer.
( at September 27, 2012 6:06 pm)
0
Private answer

Hi all,

We are running QC 12.2 . We are linking existing defects while manually running tests, However it does not automatically link it to the test instance. We want to be able to link it to the test instance. Or at least display the link icon in the list of test instances.

Is there any way to link existing defects automatically to test instance via script?

kind regards,
Swarna

Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on October 19, 2015 4:38 am