Quality Center Support and News
Showing results for 
Search instead for 
Do you mean 

How to retrieve Linked Defect Id from a Test in Test Set using OTA

SOLVED
Go to Solution
Highlighted
Advisor

How to retrieve Linked Defect Id from a Test in Test Set using OTA

I could able to retrieve Test information like whether it is passed or failed, execution date etc.,

Now I want to retrieve Linked Defect Id from that particular test in test set.

 

I am using below code to get status & Execution Date


Set TSTestFact = objTests.TSTestFactory
Set TestSetTestsList = TSTestFact.NewList("")

For Each objTestInst In TestSetTestsList
    strTestStatus = objTestInst.Status
    strExecDate = objTestInst.Field("TC_EXEC_DATE")
Next

 

Please provide sample code which can extract the defect id from a test in test set.

1 ACCEPTED SOLUTIONS
Advisor

Re: How to retrieve Linked Defect Id from a Test in Test Set using OTA

I got the solution:

Set TSTestFact = objTests.TSTestFactory
Set TestSetTestsList = TSTestFact.NewList("")
For Each objTestInst In TestSetTestsList
strTestStatus = objTestInst.Status
strExecDate = objTestInst.Field("TC_EXEC_DATE")
Set iLink = objTestInst
Set bugLinkF = iLink.BugLinkFactory
Set links = bugLinkF.NewList("")
For Each lnk In links
With lnk
Set TargetObj = .TargetEntity
defectID = CStr(TargetObj.ID)
End With
Next
Next
1 REPLIES
Advisor

Re: How to retrieve Linked Defect Id from a Test in Test Set using OTA

I got the solution:

Set TSTestFact = objTests.TSTestFactory
Set TestSetTestsList = TSTestFact.NewList("")
For Each objTestInst In TestSetTestsList
strTestStatus = objTestInst.Status
strExecDate = objTestInst.Field("TC_EXEC_DATE")
Set iLink = objTestInst
Set bugLinkF = iLink.BugLinkFactory
Set links = bugLinkF.NewList("")
For Each lnk In links
With lnk
Set TargetObj = .TargetEntity
defectID = CStr(TargetObj.ID)
End With
Next
Next