Gathering environment information

Gathering the information about test environment

Prerequisites

  1. You’ve got a configured build job on TeamCity side.
  2. You’ve run configured build job at least once and you see test results in Allure TestOps.

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 hosts to run the tests on, e.g. qa server, staging server, etc.
  • different browsers to run the tests on for web UI tests.
  • alternative VCS branch - to test changes before they appear in master branch.

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?

Adding your parameters

Say, from time to time you want to run test not on QA host but to test production site - UI or API does not matter.

In this case we could define HOST parameter which will be used in tests to define the environment (QA or Prod).

In the build job parameters of TeamCity go to the Parameters section.

  1. Click + Add new parameter and add parameter HOST.
  2. Kind will be Environment variable (env.)
  3. Value - your choice.
  4. Save
TeamCity will automatically add the prefix env. to your variable, so you need to reference this variable as env.HOST

ALT TEXT

Now, you can use this variable in your tests.

On Allure side

  1. Go to Jobs section.
  2. Locate your Job for TeamCity CI server.
  3. Click Update job from build server.

ALT TEXT

Allure will gather the information about environment variables from TeamCity CI server.

ALT TEXT

Now, you need to link env.HOST variable from TeamCity to Allure’s global Host variable in the Project’s settings .

ALT TEXT

It’s time to run the job again:

ALT TEXT

Using alternative VCS branch

Check what do you have on TeamCity side

First of all, familiarise with all the variables used by TeamCity. You find all the parameters in the build’s section Parameters.

Say, you want to run the tests on a branch which is not master, then you need to use vcsroot.branch parameter on TeamCity side and link in to global Branch parameter on Allure TestOps side.

  1. In Allure TestOps project jump to Jobs sections and locate a job for TeamCity CI server.
  2. Click on Job’s menu
  3. Click Configure.

ALT TEXT

  1. In the job’s configuration check if you have the correct CI server
  2. Click + Add parameter
  3. For the Name field use the parameter from TeamCity CI server, e.g. vcsroot.branch
  4. For the Value field you can use the default value you are going to use, e.g. “master”.
  5. The Environment variable field is the name of Allure’s global environment variable.

ALT TEXT

  1. Then jump to Project settings
  2. and Environment section of Allure TestOps.
  3. Click +Create and fill the requires fields as follows:
  4. Key is the name of parameter from CI server
  5. Environment variable is the name of Allure’s global environment variable.

ALT TEXT

Submit the changes.

Run your job again

Run your job again either from CI interface or from the Jobs section of Allure TestOps.

Check the results:

ALT TEXT

These parameters can be passed from Allure TestOps to the build jobs.

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