Configuring a test run in a GitHub Actions Workflow

After you complete the prerequisite tasks to run tests in a GitHub Actions Workflow, you can configure the test run in a GitHub Actions Workflow.

Before you begin

You must have completed the following tasks:

Procedure

  1. Perform the following steps to open the Git repository that you use or created, which has the GitHub Actions option enabled:
    1. Open the Git repository on your GitHub Enterprise server.
    2. Create a folder with the name as .github/workflows in the root folder of the repository.
    3. Create an empty YAML file in the .github/workflows folder.

      The YAML file is used to define the GitHub Action in the Actions Workflow.

  2. Perform the following steps to define the YAML file for the GitHub Action:
    1. Open the GitHub Marketplace (https://github.com/marketplace?type=) in a web browser.
    2. Search for HCL OneTest Server GitHub Action.
    3. Open the GitHub Action.
    4. Read through the information provided.
    5. Copy the contents of the YAML file that is provided in the example by clicking the copy icon Image of the copy icon..
    6. Open the YAML file that is in the .github/workflows folder of your repository and paste the copied contents.
    7. Enter the valid details as values for the required attributes in the YAML file by following the actions in the following table:
      Attribute Action
      Required attributes
      serverURL Specify the URL of the HCL OneTest Server instance.
      offlineToken Specify the Offline User Token that is generated by HCL OneTest Server.
      teamspace Specify the name of the team space that contains your project on HCL OneTest Server.
      project Specify the name of your project on HCL OneTest Server.
      branch Specify the name of the branch in the repository that contains the test resources, which can be found in the Details pane of the test resource on the Execution page.
      assetId Specify the ID of the test resource, which can be found under the Git details section in the Details pane of the test resource on the Execution page.
      Optional attributes
      environment Specify the environment that is configured in the test.
      datasets Specify the dataset that must be used at test run time, which replaces the dataset that is configured in a test.
      labels Specify text labels to identify a specific test result when the test run is complete.
      secretsCollection Specify the name of the secret collection that is configured in a test.
      variables Specify the name of the variable and its value if your test requires variables during the test run time.
      Note: You can add multiple variables that are separated by a semicolon.
    8. Save the YAML file.
  3. Perform the following steps to set up a Runner for the GitHub Action in GitHub:
    1. Click the Settings icon Image of the settings icon..
    2. Click Actions > Runners > New self-hosted runner.
    3. Follow the on-screen instructions to set up a self-hosted runner on your computer.

      After the runner is installed on your computer, you must verify that the runner is ready to run jobs in the GitHub Actions Workflow and is in the Active state. The runner is listed in the Runners pane in the Git repository.

  4. Perform the following steps to start the GitHub Action in the Workflow:
    1. Click the Actions option in the Git repository.

      The GitHub Action that you configured in the YAML file for HCL OneTest Server is displayed as an Action under Workflows.

    2. Click the HCL OneTest Server Action, and then click Run workflow.

Results

You have configured and run a resource that is in your project on HCL OneTest Server in a GitHub Action Workflow.

What to do next

You can perform any of the following tasks on the Git repository page by clicking the job that was completed:
  • View the status of the test run by expanding the Execute test section.
  • View the links to the test results and reports listed in the Execute test section.
You can perform any of the following tasks from HCL OneTest Server: