Could not remove traceability and test coverage using OTA API
Question ID: 109179
0
0

Hi ,
Below VBA code is not working for removing trace ability and coverage from a requirement, could you pls let me know what is wrong?

Sub Remove_Req_Tracebility_Along_with_Test_Coverage()

Dim td As TDAPIOLELib.TDConnection
Set td = New TDAPIOLELib.TDConnection

Dim Get_Object_To_Trace As IReqTraceFactory
Dim Get_Object_From_Trace As IReqTraceFactory
Dim Get_Test_Coverage_List As IFactoryList
Dim Test_Object As ITest3
Dim Source_Req As Req
Dim Trace_To_Req As ITrace
Dim Trace_From_Req As ITrace
Dim i As Integer
‘ Dim Req_From_Req_Object As IReq3

td.InitConnectionEx "http://xxx:8080/qcbin"
td.Login "xxxx", "1"
td.Connect "TRAINING", "ALM_Demo"

Set Source_Req = td.ReqFactory.Item(136)

If Source_Req.HasReqTraceability(0) = True Then
Debug.Print "Traceability From Exists"
Set Get_Object_From_Trace = Source_Req.ReqTraceFactory(0)
For Each Trace_From_Req In Get_Object_From_Trace.NewList("")
Debug.Print Trace_From_Req.FromReq.ID
Get_Object_From_Trace.RemoveItem (Trace_From_Req.FromReq.ID)
Source_Req.Post
Source_Req.Refresh
Next

End If

If Source_Req.HasReqTraceability(1) = True Then
Debug.Print "Traceability To Exists"
Set Get_Object_To_Trace = Source_Req.ReqTraceFactory(1)
For Each Trace_To_Req In Get_Object_To_Trace.NewList("")
Debug.Print Trace_To_Req.ToReq.ID
Get_Object_To_Trace.RemoveItem (Trace_To_Req.ToReq.ID)
Source_Req.Post
Source_Req.Refresh
Next

End If

If Source_Req.HasCoverage = True Then
Debug.Print "Coverage Exists"
Set Get_Test_Coverage_List = Source_Req.GetCoverList
For i = 1 To Get_Test_Coverage_List.Count
Debug.Print Get_Test_Coverage_List.Item(i).ID
Get_Test_Coverage_List.Remove (i)
Source_Req.Post
Source_Req.Refresh
Next i
End If

Set Get_Object_From_Trace = Nothing
Set Get_Object_To_Trace = Nothing
Set Source_Req = Nothing
Set Get_Test_Coverage_List = Nothing

td.Disconnect
Set td = Nothing

End Sub

Marked as spam
Posted by (Questions: 33, Answers: 21)
Asked on October 3, 2019 2:32 pm
273 views
EyeOnTesting

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

X
Scroll to Top