Apologies. Let me first explain what I'm trying to do. When a user changes a field, called "Update Requirements" on the Test Set Details screen, the method Template_TestSet_FieldCanChange will be invoked. Once I've determined that the "Update Requirements" field has been changed to Yes, a call to method UpdateRequirments() will be made. The code in UpdateRequirments() will be responsible for getting the list of Test in the current Test Set (I'm attempting to accomplish this by setting the Test Instance filter to the Target Cycle at the Test Set level). Once I've gotten the list of Tests for the Current Test Set I'll obtain the linked requirements for each Test. I will then update a user defined field for each requirement. This user defined requirement field will have a history, be under Version Control and hold the Execution status for a linked Test specific for a specific Target Cycle. The Requirement Module's Direct Cover status field currently will not satisfy our custom reporting needs. Please see below code:
Function Template_TestSet_FieldCanChange(FieldName, NewValue) On Error Resume Next If FieldName = "CY_USER_02" And NewValue = "Yes" Then UpdateReqExecStatus End If On Error End Function Sub UpdateReqExecStatus Dim testInstanceObj Dim testInstanceFact Dim testInstanceList Dim testInstanceFilter 'Instantiate a Test Instance Factory object Set testInstanceFact = TDConnection.TSTestFactory Set testInstanceFilter = testInstanceFact.Filter testInstanceFilter.Filter("TC_ASSIGN_RCYC") = TestSetTest_Fields("TC_ASSIGN_RCYC").Value.name Msgbox "1st" set testInstanceList = testInstanceFact.NewList(testInstanceFilter) Msgbox "2nd" Msgbox "Count: " & testInstanceList.Count Msgbox "3rd" Set testInstanceObj = Nothing set testInstanceFact = Nothing set testInstanceList = Nothing set testInstanceFilter = Nothing End Sub
Msgbox "TC_ASSIGN_RCYC" & "TestSetTest_Fields(""TC_ASSIGN_RCYC"").Value.name correctly displays the Target Cycle I expect to see, so that shows that I have visibility into the "Test Instance" Project Entities from the Test Set function, but then I wondered if I was allowed to set a filter for Test Instance when being called from a TestSet function so I tried setting a cross filter:
Function Template_TestSet_FieldCanChange(FieldName, NewValue) On Error Resume Next If FieldName = "CY_USER_02" And NewValue = "Yes" Then UpdateReqExecStatus End If On Error End Function Sub UpdateReqExecStatus Dim testInstanceObj Dim testInstanceFact Dim testInstanceList Dim testInstanceFilter Dim testSetFac Dim testSetFilter Set testSetFac = TDConnection.TestSetFactory Set testSetFilter = testSetFac.Filter 'set the target cycle field for the Test Set testSetFilter.Filter("CY_ASSIGN_RCYC") = TestSetTest_Fields("TC_ASSIGN_RCYC").Value.name Msgbox "1st" set testInstanceFact = TDConnection.TSTestFactory set testInstanceFilter = testInstanceFact.Filter Msgbox "2nd" testInstanceFilter.SetXFilter "TEST-TESTSET", True, testSetFilter.Text set testInstanceList = testInstanceFact.NewList(testInstanceFilter.Text) Msgbox "Count: " & testInstanceList.Count Msgbox "3rd" set testInstanceObj = Nothing set testInstanceFact = Nothing set testInstanceList = Nothing 'set testInstanceFilter = Nothing set testSetFac = Nothing set testSetFilter = Nothing End Sub
After running the above code I see the same behavior as described in the first post. I do not see any messages boxes after the line of code " set testInstanceList = testInstanceFact.NewList(testInstanceFilter.Text)" Do you see any problems with my approach?