GitLab CI
To set up connection between GitLab and Testomat.io, first, you need to configure your GitLab account:
- Add new Pipeline Trigger in your GitLab Project - read more.
- Go to ‘Code’ -> ‘Repository’ and create .gitlab-ci.yml file or add the job to existing one. E.g. check by link.
It should contain next commands:
- export TESTOMATIO="${testomatio}" - export TESTOMATIO_URL="${testomatio_url}" - export TESTOMATIO_RUN="${run}"
- The Job should include a step where the test runner is executed with
--grep
option andTESTOMATIO
environment variables passed in. For instance:
- npx codeceptjs run-workers 2 --grep "${grep}"
When GitLab is set up, go to your Project in Testomat.io and configure GitLab CI connection:
- Go to ‘Settings’.
- Select ‘Continuous Integration’.
- Click ‘Connect to CI’.
- Select ‘GitLab’ and enter following details on the ‘Connection’ tab:
Gitlab Host
.GitLab CI Trigger Url
- trigger pipeline URL, created in GitLab during Step 1.Trigger Token
- Active pipeline trigger token, created in GitLab during Step 1.
- Open ‘Configuration’ tab and check the default
ref
value.ref
specifies the target branch or tag for test execution. By default, it is set tomaster
, but you can adjust this if your main branch uses a different name, such asmain
.
- Go to ‘Input Variables’ tab and enable
run
,testomatio token
andTESTOMATIO_URL
variables to pass them from Testomat.io.
- Click on ‘Save’ button to save the connection.
8a. When the connection is saved, open ‘Runs’ page and select Run Automated Tests in CI
option in extra menu.
9a. Select ‘GitLab’ profile in a list, select a target ref and any other variables, if any were configured. Optionally, select a Test Plan or create a new one.
10a. Click on ‘Launch’ button and wait for the results.
OR
8b. On ‘Tests’ page select any automated suite or test case -> click ‘Extra menu’ button -> select ‘Run Tests’ option -> open ‘Run in CI’ tab.
9b. Select ‘GitLab’ profile in a list, as well, select a target ref and any other variables, if any were configured.
10b. Click on ‘Launch’ button and wait for the results.
This will start a new pipeline in GitLab CI. Please check that the job was successfully triggered and completed. After the job has finished, a run report will be available on Runs page of Testomat.io.