Highlighted
Honored Contributor.
Honored Contributor.
596 views

Prevent Test Set Run until Test Set Folder is assigned to a Cycle

Jump to solution

I'm generating a report using database queries through OTA that tells me if any Test set was run that was not assigned to a Cycle.  That's been working great but now my manager wants to have ALM prevent an analyst from launching a Test set if the parent folder has not been assigned to a Cycle yet.  This would prevent the need of this report which is one less thing I'll have to run, and 1 less thing the team leads will need to review.

 

I found a few things searching here but they all tell me information about the test from the Test Plan, not the Test Lab.  Anyone have some pointers for me to

1.  Find the parent folder for the selected Test Set

2.  Get the "CY_ASSIGN_RCYC" for that Parent Folder.  "I just need to ensure it's not empty"

 

What I have been playing with so far.

Sub Template_RunTestsManually(Tests)

     For i = 0 To UBound(Tests)
     Set test = TDConnection.TSTestFactory.Item(Tests(i)).Test
     msgbox "RunTestsManually(" & test.Name & ")"
     msgbox test.FolderId 'Returns folder from Test Plan, not Test Lab

   Next

End Sub

Sub Template_RunTestSet(Tests)
'Will need to duplicate the above as user may click one or the other to launch
End Sub
0 Likes
1 Solution

Accepted Solutions
Highlighted
Honored Contributor.
Honored Contributor.

SYSINTERNALS Debug view to the rescue!

Turns out I needed to use the Common Script sections ActionCanExecute to pull this off.

Function Template_ActionCanExecute(ActionName)
   if ActionName = "TestSetView.Run" or ActionName = "TestSetView.RunTestSet" Then
     msgbox "TestSetView.Run"
     If TestSet_Fields.Field("CY_ASSIGN_RCYC").IsNull Then
       FldrNm = TestSet_Fields("CY_FOLDER_ID").Value
       MsgBox "Warning.  Please assign the Test Set to a test cycle!" & vbCRLF & "Right-click the folder '" & FldrNm & "' and select 'Assign To Cycle')." Template_ActionCanExecute = False Exit Function End If End if Template_ActionCanExecute = Template_DefaultRes On Error GoTo 0 End Function

 

It will now use the Check that Jan provided and if no cycle is found it will prevent the run window from launching.

View solution in original post

0 Likes
3 Replies
Highlighted
Respected Contributor.. Respected Contributor..
Respected Contributor..

 

Hi,

We do it as follows (workflow linked to Test Lab) :

Sub RunTestsManually(Tests)
  On Error Resume Next
  If TestSet_Fields.Field("CY_ASSIGN_RCYC").IsNull Then
      MsgBox "Warning.  Please assign the Test Set to a test cycle!  You can do this selecting a cycle for a parent folder of the test set (right-click and select 'Assign To Cycle')."
  End If
  On Error GoTo 0
End Sub

 

We even force the people to fix a test cycle already before they can add tests to the test sets :

Function TestSet_CanAddTests(Tests)
   On Error Resume Next

   If TestSet_Fields.Field("CY_ASSIGN_RCYC").IsNull Then
      MsgBox "Action has been cancelled.  Please assign the Test Set first to a test cycle!  You can do this selecting a cycle for a parent folder of the test set (right-click and select 'Assign To Cycle')."
      TestSet_CanAddTests = False
   Else
      TestSet_CanAddTests = DefaultRes

   End If
   On Error GoTo 0
End Function

 

Hope this helps....

 

Best regards,

Jan

Highlighted
Honored Contributor.
Honored Contributor.

Thanks for the response Jan,

 

The first part works to give me a message box, but I can't seem to prevent them from performing the run after clicking OK to the msgbox.

Doing Template_RunTestsManually = False just throws an error. 

Any other ideas on how to stop the run from launching?

 

 

At this time I can't prevent adding the tests as lot's of analysts pre-stage their work before the cycle has been decided.  Baby steps I guess...  perhaps next year I'll be able to implement that.

 

Thanks for your assistance

Mike

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

SYSINTERNALS Debug view to the rescue!

Turns out I needed to use the Common Script sections ActionCanExecute to pull this off.

Function Template_ActionCanExecute(ActionName)
   if ActionName = "TestSetView.Run" or ActionName = "TestSetView.RunTestSet" Then
     msgbox "TestSetView.Run"
     If TestSet_Fields.Field("CY_ASSIGN_RCYC").IsNull Then
       FldrNm = TestSet_Fields("CY_FOLDER_ID").Value
       MsgBox "Warning.  Please assign the Test Set to a test cycle!" & vbCRLF & "Right-click the folder '" & FldrNm & "' and select 'Assign To Cycle')." Template_ActionCanExecute = False Exit Function End If End if Template_ActionCanExecute = Template_DefaultRes On Error GoTo 0 End Function

 

It will now use the Check that Jan provided and if no cycle is found it will prevent the run window from launching.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.