Quality Center / ALM Practitioners Forum
cancel

OTA : Condition Object for Test Lab Execution Flows

SOLVED
Go to solution
Highlighted
Contributor. ShobhitMathur
Contributor.

OTA : Condition Object for Test Lab Execution Flows

Hi,

I have created an execution flow diagram for a test set in HP ALM. Now i want to create a reference of this diagram in VBScript. I got the all the conditions of the diagram using the ConditionFactory Object. For an individual condition i'm trying to get the ID of Source Test Case & Target Test Case. The API reference says that Condition.Target property returns a TSTest Object. But it isn't returning an object. It is returning a number.

How do i obtain a TSTest object from a Condition Object?

Thanks

Shobhit

1 ACCEPTED SOLUTION

Accepted Solutions
Contributor. ShobhitMathur
Contributor.
Solution

Re: OTA : Condition Object for Test Lab Execution Flows

Found a solution for this.

Scenario - I want to create dependencies in my TestSet (using Execution Flows). I want the execution of 5 test cases dependent on the Run Status of another TestCase. If it fails, the 5 dependent Test Cases should be blocked.

Solution - 

Put this code in the Run_AfterPost Function of the Workflow script - 

 

     If Run_Fields("RN_STATUS").Value = "Failed" Then
       'msgbox TestSetTest_Fields("TC_TESTCYCL_ID").Value
       TSSource = TestSetTest_Fields("TC_TESTCYCL_ID").Value
       testSetName = Run_Fields("RN_CYCLE_NAME").value
       'msgbox testSetName
       Set QCConnection = TDConnection
       Set testSetFactory = TDConnection.testSetFactory
       Set testSetFilter = testSetFactory.Filter
       testSetFilter.Filter("CY_CYCLE") = testSetName
       Set testSetList = testSetFilter.NewList() ' Get list of test sets

       For Each testSet In testSetList
           'msgbox "Inside Test Set. Count - " & testSetList.count
           'msgbox testSet.Name
           Set testSetConditionFactory = testSet.ConditionFactory
           Set condFact = testSetConditionFactory.NewList("")
           For Each Condition In condFact
               'msgbox "Inside Condition Factory"
               Source = Condition.Source
               Target = Condition.Target
               'msgbox "Source: " & Source & " Target: " & Target
               'msgbox "TSSource: " & TSSource & " Source: " & Source
               If CInt(TSSource) = CInt(Source) Then
                  'msgbox "I'm In!"
                  Set testSetTestFactory = testSet.TSTestFactory
                  Set tsTestList = testSetTestFactory.NewList("")
                  For Each tsTest In tsTestList
                      'msgbox "Inside Test List. COunt - "& tsTestList.Count
                      'msgbox tsTest.Name & tsTest.ID
                      'msgbox tsTest.Status
                      If tsTest.ID = Target Then
                         tsTest.Status = "Blocked"
                         tsTest.post
                      End If
                  Next
               End If
           Next
       Next
     End If

The ALM OTA documentation says that Condition.Target returns a TSTest Object, which is wrong. It return the ID of Test Instance in the TestSet (Or TestSetTest_Fields("TC_TESTCYCL_ID")). So i had to iterate through all the Test Instances inside the TestSet to find it.

Hope this helps.

Shobhit

1 REPLY
Contributor. ShobhitMathur
Contributor.
Solution

Re: OTA : Condition Object for Test Lab Execution Flows

Found a solution for this.

Scenario - I want to create dependencies in my TestSet (using Execution Flows). I want the execution of 5 test cases dependent on the Run Status of another TestCase. If it fails, the 5 dependent Test Cases should be blocked.

Solution - 

Put this code in the Run_AfterPost Function of the Workflow script - 

 

     If Run_Fields("RN_STATUS").Value = "Failed" Then
       'msgbox TestSetTest_Fields("TC_TESTCYCL_ID").Value
       TSSource = TestSetTest_Fields("TC_TESTCYCL_ID").Value
       testSetName = Run_Fields("RN_CYCLE_NAME").value
       'msgbox testSetName
       Set QCConnection = TDConnection
       Set testSetFactory = TDConnection.testSetFactory
       Set testSetFilter = testSetFactory.Filter
       testSetFilter.Filter("CY_CYCLE") = testSetName
       Set testSetList = testSetFilter.NewList() ' Get list of test sets

       For Each testSet In testSetList
           'msgbox "Inside Test Set. Count - " & testSetList.count
           'msgbox testSet.Name
           Set testSetConditionFactory = testSet.ConditionFactory
           Set condFact = testSetConditionFactory.NewList("")
           For Each Condition In condFact
               'msgbox "Inside Condition Factory"
               Source = Condition.Source
               Target = Condition.Target
               'msgbox "Source: " & Source & " Target: " & Target
               'msgbox "TSSource: " & TSSource & " Source: " & Source
               If CInt(TSSource) = CInt(Source) Then
                  'msgbox "I'm In!"
                  Set testSetTestFactory = testSet.TSTestFactory
                  Set tsTestList = testSetTestFactory.NewList("")
                  For Each tsTest In tsTestList
                      'msgbox "Inside Test List. COunt - "& tsTestList.Count
                      'msgbox tsTest.Name & tsTest.ID
                      'msgbox tsTest.Status
                      If tsTest.ID = Target Then
                         tsTest.Status = "Blocked"
                         tsTest.post
                      End If
                  Next
               End If
           Next
       Next
     End If

The ALM OTA documentation says that Condition.Target returns a TSTest Object, which is wrong. It return the ID of Test Instance in the TestSet (Or TestSetTest_Fields("TC_TESTCYCL_ID")). So i had to iterate through all the Test Instances inside the TestSet to find it.

Hope this helps.

Shobhit