Copy Code
|
|
---|---|
Private Function AddTestToBugLink(theTest As Test, _ theBug As Bug, _ Optional LinkComment) As Link ' Link a test to a defect Dim linkF As LinkFactory Dim thelink As Link Dim linkableTest As ILinkable Set linkableTest = theTest Set linkF = linkableTest.BugLinkFactory Set thelink = linkF.AddItem(theBug) If Not IsMissing(LinkComment) Then _ thelink.comment = LinkComment thelink.Post Set AddTestToBugLink = thelink Exit Function FUNC_ERR: Set AddTestToBugLink = Nothing End Function '######################################################### Private Function LinkBugToReq(theBug As Bug, theReq As Req, _ Optional LinkComment) As Link ' Link a requirement to a defect On Error GoTo FUNC_ERR Dim linkF As LinkFactory Dim thelink As Link Dim linkableReq As ILinkable Set linkableReq = theReq Set linkF = linkableReq.BugLinkFactory Set thelink = linkF.AddItem(theBug) If Not IsMissing(LinkComment) Then thelink.comment = LinkComment thelink.Post Set LinkBugToReq = thelink Exit Function FUNC_ERR: Set LinkBugToReq = Nothing End Function '######################################################### Private Function GetBugToTestLink(test1 As Test, Bug1 As Bug) As Link ' Get the link between a test and a defect On Error GoTo FUNC_ERR Dim linkF As LinkFactory Dim thelink As Link Dim linkableBug As ILinkable Set linkableBug = test1 Set linkF = linkableBug.BugLinkFactory Dim oList As IList Dim aFilter As TDFilter Set aFilter = linkF.Filter aFilter.Filter("LN_ENTITY_TYPE") = "TEST" aFilter.Filter("LN_BUG_ID") = Bug1.ID Set oList = linkF.NewList(aFilter.Text) If oList.Count > 0 Then Set thelink = oList.Item(1) Debug.Print oList.Count Debug.Print thelink.Field("LN_LINK_COMMENT") Debug.Print thelink.Field("LN_ENTITY_ID") Debug.Print thelink.Field("LN_BUG_ID") Debug.Print thelink.Field("LN_LINK_ID") Set GetBugToTestLink = thelink Else errmsg = "Could not retrieve link" GoTo FUNC_ERR End If Exit Function FUNC_ERR: Set GetBugToTestLink = Nothing End Function |