Integration with TeamCity using allurectl
This instruction covers a limited integration with TeamCity using the allurectl CLI tool.
For a more feature-rich integration, we recommend using the plugin, which additionally allows you to start TeamCity builds from the Allure TestOps interface. See Integration with TeamCity for more information on using the plugin.
TeamCity integration allows you to receive test results from TeamCity builds and automatically create corresponding test cases in Allure TestOps.
To set up integration with TeamCity using allurectl, you need to:
- Create an API token in Allure TestOps.
- Specify the API token and other necessary environment variables in your TeamCity project configuration.
- Edit your build step in TeamCity to use allurectl to upload test results.
1. Create API token in Allure TestOps
In Allure TestOps, click your avatar and go to API Tokens.
Click + Token.
Enter a name for the token (e.g., "Token for TeamCity") and click Create.
Allure TestOps will generate the token and display it in a modal window.
Click the Copy icon to copy the token into clipboard.
2. Specify environment variables in TeamCity
In TeamCity, go to your project configuration page.
In the left menu, click Parameters.
Click Add new parameter and add the following environment variables:
Name Value env.ALLURE_CI_TYPE
teamcity env.ALLURE_ENDPOINT
URL of your Allure TestOps instance.
Example: https://testops-instance.comenv.ALLURE_JOB_NAME
%system.teamcity.buildConfName% env.ALLURE_JOB_RUN_NAME
%teamcity.build.id% env.ALLURE_JOB_RUN_UID
%teamcity.build.id% env.ALLURE_JOB_RUN_URL
https://your-teamcity-instance-domain/viewLog.html?buildId=%teamcity.build.id% env.ALLURE_JOB_UID
%system.teamcity.buildType.id% env.ALLURE_LAUNCH_NAME
teamcity via allurectl - %build.number% env.ALLURE_PROJECT_ID
ID of your project in Allure TestOps env.ALLURE_RESULTS
Directory that contains test results.
Example: build/allure-resultsenv.ALLURE_TOKEN
API token you created in Allure TestOps
3. Edit build step in TeamCity
In TeamCity, go to your build configuration page.
In the left menu, click Build Step: Command Line.
Click Edit next to your build step.
Modify the build script, wrapping the command that runs the tests in an allurectl call.
For example, if you use Gradle to run your tests, replace the test run command:
./gradlew clean test
with the following lines:
curl -fsSL https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_amd64 -o allurectl chmod +x allurectl ./allurectl watch -- ./gradlew clean test
See this article to learn more about using allurectl.