How to retrieve Linked Defect Id from a Test in Test Set using OTA (299 Views)
Reply
Highlighted
Advisor
Posts: 17
Registered: ‎03-08-2009
Message 1 of 2 (299 Views)
Accepted Solution

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.

Advisor
Posts: 17
Registered: ‎03-08-2009
Message 2 of 2 (278 Views)

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.