Continuous Integration
Testomatio allows executing tests on CI from its interface. A single test, suite, test plan, or all tests can be executed automatically on CI.
Currently following CI systems supported:
- Jenkins
- Atlassian Bamboo
- GitHub Actions
- GitLab CI
- Azure Pipelines
- Circle CI
- BitBucket Pipelines
- Teamcity
Testomatio uses REST API to trigger jobs on external CI systems. IDs of tests or suites can be passed to the job so only a specific test or suite will be executed. The test runner greps all tests by their IDs and executes a subset of tests. Then a report is sent back to Testomatio via reporter.
Connecting CI server to Testomatio consist of the following steps:
- Create Testomatio Project
- Import automated tests into that project from a repository
- Assign Ids for imported tests source code
- Create a new job in CI according to instructions on this page
- Connect CI server to Testomatio
- Run your tests or suites to get reports!
Configuring CI
CI configuration has 3 steps:
- establishing a connection with CI
- setting up required input variables
- setting up custom configuration variables
Follow the guide for a corresponding CI to set it up.
Input Variables
While connection settings can be different across CI settings, the list of input variables is the same.
For example, Testomatio sends grep
variable to CI to identify which tests should be executed. It may pass other input variables
which can be used on CI to improve reporting.
Here is how run
input variable can be accessed on different CIs:
- Atlassian Bamboo:
${bamboo.run}
- GitHub Actions:
${github.event.inputs.run}
Here is the list of preconfigured input variables:
run
- passes Run ID to CI. If this option is toggled on, when a run is created in Testomatio it is instantly added to the list of runs marked as “Scheduled”. On CIrun
variable must be passed asTESTOMATIO_RUN
environment variable to a reporter. This allows mapping a scheduled run to the run which is currently processed. IfTESTOMATIO_RUN
is not set, a duplicate run will be created.testomatio
- passes project access key to CI. This input variable must be passed asTESTOMATIO
environment variable to match the Testomatio project. Toggle on this option if you prefer not to hardcode Testomatio Project ID in CI configuration but to obtain this value on launch. This may be useful if you have a different Testomatio project configured for on CI run.testomatio_url
- when working on a self-hosted Testomatio instance, this variable can be used to pass Testomatio endpoint to CI system. Passtestomatio_url
environment variable toTESTOMATIO_URL
Environment Configuration
Sometimes extra configuration is required for CI job. For instance, extra configuration variables can be used to specify:
- browser
- target branch
- staging/production environments
Testomatio allows to predefine configuration variables and adjust them for each run. Config variables can be set in “Configuration” tab on CI connection settings.
Config variables should be put per line with the default value passed in with =
. The format is similar to .env
file format:
To set a variable without a default value just pass it as on a line without
=
Those variables will be available for a reconfiguration on each CI Run executed from Testomatio.
If a variable value contains comma ,
like in example above: chrome,firefox,safari
, these values will be displayed with the select box. Otherwise, a simple input will be shown:
These variables will be passed to CI in the same manner as grep
parameter. So, CI job should be prepared to handle these config variables. For instance, if GitHub Actions are used, values are passed as inputs
and can be used like this:
Assigning IDs
To execute a specific test or a suite a test runner should have a way to find a test by its unique name. For this reason, Testomatio IDs can be used. If tests in the source code will have Testomatio IDs it will be very simple to filter tests. We provide a semi-automatic way to assign Testomatio IDs to tests in source code.
For JavaScript frameworks use the same check-tests
command you used for importing tests with --update-ids
. The tests must be already imported in Testomatio:
For Cucumber tests use check-cucumber
command with the similar --update-ids
command. The command should be the same as for importing plus --update-ids
option:
This command will update your source code. Please check the changes before committing it. If the Testomatio IDs were placed correctly you can commit your changes to repository.
From now on, Testomatio can use Test IDs to run exact tests and suites on Continuous Integration servers.