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.

How?

Let’s find out…

Add environment parameters to a Job on Circle CI 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 Circle CI project start editing the config of your pipeline Settings => CI/CD and
  2. Locate environment section.
  3. Add an environment variable (e.g. TESTING_HOST)
environment:
#<snip>
      TESTING_HOST: https://qa.somehost.xyz
#<snip>
  1. Include this variable in your tests
      - run: ./allurectl watch -- ./gradlew test -Ptest_host=${TESTING_HOST}

The next steps is the configuration of Allure TestOps - you must explicitly mark the variables which Allure TestOps needs to process.

Set up Allure TestOps to receive environment variable from Circle CI

Administration section of Allure TestOps

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 https://support.qameta.io

Project’s Environment section

  1. Jump to your project Settings.
  2. Jump to the Environment section.
  3. Click Create.
  4. Add the environment variable (TESTING_HOST) 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 https://support.qameta.io

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

if you see this, please report to https://support.qameta.io

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