Gathering environment information

Gathering the information about test environment

For what?

It is quite rare situation when tests run without any parameters which define different conditions to run the tests. These conditions could be for instance:

  • different browsers to run the tests on for web UI tests.
  • different hosts to run the tests on, e.g. qa server, staging server.
  • VCS branch - to test changes before they appear in master branch. It’s a bit tricky for gitlab.

When Allure TestOps gathered this information, it will allow you starting the build jobs with the environment of your choice right from its UI.


Let’s find out…

Add environment parameters to a Job on GitHub side

Now, say by default our test will check the production site using its API but from time to time we might want to test QA version of the site or staging or whatever version we could have. This requires tests’ parameterisation.

Adding parameters

  1. In your GitHub project start editing the config of your workflow (it’s under .github/workflows)
  2. Add env: section to your step and add the environment variables, you will use during your tests.
      - name: Build with Gradle
        run: ./allurectl watch -- ./gradlew test
          ALLURE_JOB_UID: ${{steps.allure-job-uid.outputs.result}}
          TEST_ENDPOINT: ${{ github.event.inputs.TEST_ENDPOINT }}
          TEST_BROWSER: ${{ github.event.inputs.TEST_BROWSER }}

Let’s follow the path of an environment variable, e.g. TEST_ENDPOINT.

Earlier in the configuration of our example workflow we’ve defined TEST_ENDPOINT as an input

        description: "Endpoint for tests"
        required: true

  1. You could include this variable in your tests, e.g.
      - run: ./allurectl watch -- ./gradlew test -Ptest_host=${TEST_ENDPOINT}

When allurectl executes the tests and sends test results to AllureTestOps, it also sends the data about all environment variables available during the scope of tests run. So, next steps are the configuration of Allure TestOps when you must explicitly mark the environment variables which Allure TestOps needs to process.

Set up Allure TestOps to receive environment variable from GitHub

There are two steps to set up the processing of the environment data:

  1. Global configuration.
  2. Project’s configuration.

Administration section of Allure TestOps (global config)

Let’s set up Allure TestOps project settings for this environments information processing.

If you haven’t registered the environment variable yet, then first you need…

  1. Invoke your main user’s menu.
  2. Go to the Administration section of Allure TestOps (you need admin’s rights).
  3. Go to the Environment section.
  4. Introduce a new variable by clicking +Create

You just need to provide the name/label for the global variable. In our example it’s Host, this variable will contain the URL of the host where your tests will be running.

if you see this, please report to

Project’s Environment section

  1. Jump to your project Settings.
  2. Jump to the Environment section.
  3. Click Create.
  4. Add the environment variable (TEST_ENDPOINT) to Key section and Select registered Environment (Host) from the drop-down list.
  5. Submit the changes.

That’s it!

if you see this, please report to

… and run the build job again from Gitlab’s UI.

if you see this, please report to

Now, it’s time to run your build jobs from Allure TestOps server.