Skip to content

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:

Testomatio - Jenkins

Then, follow the instructions added below:

  1. Create a new Jenkins job. Select ‘Freestyle project’.

Testomatio - Jenkins

  1. Make this build parametrized

Testomatio - Jenkins

  1. Add the following parameters as a string with empty default values:
  • run
  • testomatio
  • grep
  1. Go to ‘Build Triggers’ and select ‘Trigger build remotely’.

Testomatio - Jenkins

  1. Proceed with configuring the Job and set all required parameters like SCM and build steps.

Testomatio - Jenkins

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}"

Testomatio - Jenkins

  1. Save the build.

After Jenkins is set up, go to Testomat.io and create a new CI connection inside your project:

  1. Go to ‘Settings’.
  2. Select ‘Continuous Integration’.
  3. Click ‘Connect to CI’.

Testomatio - CI

  1. 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.

Testomatio - Jenkins

  1. 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.

  1. Click ‘Save’ button and check the connection.

Testomatio - Jenkins

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.

Testomatio - CI Run

8a. Select ‘Jenkins’ profile in a list. Optionally, select a Test Plan or create a new one.

Testomatio - Jenkins

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.

Testomatio - Jenkins

  1. Launch a Run and wait for the results.

Testomatio - Jenkins