Jenkins
To connect Jenkins to Testomat.io you will need a user and an API Token created on Jenkins. API token can be added on ‘Configure’ page of the current user:
Then, follow the instructions added below:
- Create a new Jenkins job. Select ‘Freestyle project’.
- Make this build parametrized
- Add the following parameters as a string with empty default values:
run
testomatio
grep
- Go to ‘Build Triggers’ and select ‘Trigger build remotely’.
- Proceed with configuring the Job and set all required parameters like SCM and build steps.
Within a step pass in configured parameters as environment variables into the test runner. Let’s take CodeceptJS command as an example:
TESTOMATIO_RUN=${run} TESTOMATIO=${testomatio} npx codeceptjs run --grep "${grep}"
- Save the build.
After Jenkins is set up, go to Testomat.io and create a new CI connection inside your project:
- Go to ‘Settings’.
- Select ‘Continuous Integration’.
- Click ‘Connect to CI’.
- Select ‘Jenkins’ and fill in all required fields:
Jenkins Hostname
- URL of Jenkins host.Username
- a user on Jenkins which will trigger builds.API Token
- a token we created previously in the user’s settings.Job Name
- the name of a job we just created.
- Switch to ‘Input variables’ tab and enable variables that were configured for parametrized builds.
You can pass more input variables if you set them in Environment Configuration. For example: test environment, browser, branch, etc.
- Click ‘Save’ button and check the connection.
Now you can run a test or a group of tests via Jenkins CI.
7a. Open ‘Runs’ page then select Run Automated Tests in CI
option in extra menu.
8a. Select ‘Jenkins’ profile in a list. Optionally, select a Test Plan or create a new one.
OR
7b. On ‘Tests’ page select any automated suite or test case -> click ‘Extra menu’ button -> select ‘Run Tests’ option -> open ‘Run in CI’ tab.
8b. Select ‘Jenkins’ profile in a list.
- Launch a Run and wait for the results.