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 tasks that are mentioned in Prerequisites to run tests in a GitHub Actions Workflow.

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 the HCL OneTest API 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 then paste the copied contents.
    7. Enter the valid details as values for the required attributes in the YAML file by following the action in the following table:
      Attribute Action
      Required attributes
      projectDir Specify the path to the location on your computer where the HCL OneTest API project resides.
      projectName Specify the name of the HCL OneTest API project.
      environment Specify the name of the environment configured in your HCL OneTest API project.
      tests Specify the name of the test in your HCL OneTest API project.
      Optional attributes
      parameterFile Specify the path to a parameter file that contains the details of the project and environment, and the run arguments for one or more tests.
      junitDir Specify the path to a folder on your computer in which the JUnit Report is to be saved for the tests.
    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 take up 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 API is displayed as an Action under Workflows.

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

Results

You have configured and run a resource that is in your project on HCL OneTest API 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.