Example: Customizing the workflow in HP ALM Quality Center

You can add workflow scripts to HP Quality Center to customize the user interface and add actions for users.

About this task

In this workflow customization example, a toolbar button is added to the Test Lab module that allows users to set an HCL OneTest API environment for all tests in the current Test Set.

Note: The script included in the following example is supported only with HP ALM Quality Center 11.5, 12.2, or 12.5.

Procedure

  1. Start Quality Center and log in to your project.
  2. Select Customize from the Tools menu.
  3. Click Workflow on the left side of the screen.
  4. On the Workflow page, click the Script Editor link.
  5. Click the Toolbar Button Editor tab on the Script Editor page.
  6. Click Test Lab in the Command bar list.
  7. Click Add to add a command.
  8. Change the following items:
    • Caption: GHTester Environment
    • Hint: Select the GHTester Environment for all Tests in the Test Set
    • Action Name: TestLab_GHTesterEnv
  9. Using the list of available images, choose an icon to display on the toolbar button.
  10. Click Apply.
  11. Click the Script Editor tab.
  12. Expand the tree on the left to show Workflow Scripts > Common script > ActionCanExecute and select it.
  13. Change the script (on the right) to the following.
    Function ActionCanExecute(ActionName)
      On Error Resume Next
    If ActionName = "UserDefinedActions.TestLab_GHTesterEnv" Then
        If IsObject(TDConnection) Then
          Set TSTestFactory = Actions.TSTestFactory
          Set TSTest = TSTestFactory.Item(TestSetTest_Fields("TC_TESTCYCL_ID").value)
          Set dlg = CreateObject("GHTester_ExecConfig.EnvSelectionHelper")
          If IsObject(TSTest) Then
             dlg.EnvironmentDialog TDConnection, TSTest
          Else
             MsgBox "No test was selected. Please select a Test instance in a Test Set's Execution Grid and try again.", 48, "No Test Selected"
          End If
        End If
      End If
    On Error GoTo 0
    End Function
    Note: If your script already had other action buttons that are defined, you must insert only the following code into the existing script:
    If ActionName = "UserDefinedActions.TestLab_GHTesterEnv" Then
        If IsObject(TDConnection) Then
          Set TSTestFactory = Actions.TSTestFactory
          Set TSTest = TSTestFactory.Item(TestSetTest_Fields("TC_TESTCYCL_ID").value)
          Set dlg = CreateObject("GHTester_ExecConfig.EnvSelectionHelper")
          If IsObject(TSTest) Then
             dlg.EnvironmentDialog TDConnection, TSTest
          Else
             MsgBox "No test was selected. Please select a Test instance in a Test Set's Execution Grid and try again.", 48, "No Test Selected"
          End If
        End If
      End If
  14. On the File menu in the Script Editor, click Save.
  15. Close the Script Editor.
  16. Click the RETURN button to go back to Quality Center.
  17. When prompted in the Customization Changes dialog box, specify whether the change is major or minor (this specification affects how the change is passed to users) and click OK.

    After users connect to the project in a new session, the toolbar button is displayed on the Test Lab toolbar.