Gathering the information about test environment
Prerequisites
- You’ve got a configured build job on TeamCity side.
- 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.
- Click + Add new parameter and add parameter HOST.
- Kind will be Environment variable (env.)
- Value - your choice.
- Save
TeamCity will automatically add the prefix env. to your variable, so you need to reference this variable as env.HOST
Now, you can use this variable in your tests.
On Allure side
- Go to Jobs section.
- Locate your Job for TeamCity CI server.
- Click Update job from build server.
Allure will gather the information about environment variables from TeamCity CI server.
Now, you need to link env.HOST variable from TeamCity to Allure’s global Host variable in the Project’s settings .
It’s time to run the job again:
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.
- In Allure TestOps project jump to Jobs sections and locate a job for TeamCity CI server.
- Click on Job’s menu
- Click Configure.
- In the job’s configuration check if you have the correct CI server
- Click + Add parameter
- For the Name field use the parameter from TeamCity CI server, e.g. vcsroot.branch
- For the Value field you can use the default value you are going to use, e.g. “master”.
- The Environment variable field is the name of Allure’s global environment variable.
Linking variables
- Then jump to Project settings
- and Environment section of Allure TestOps.
- Click +Create and fill the requires fields as follows:
- Key is the name of parameter from CI server
- Environment variable is the name of Allure’s global environment variable.
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:
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.