Testrunner Toolkit with Jenkins

These examples can apply to virtually any Jenkins deployment, provided that you already have some existing automated tests, have access to the Jenkins instance, and are either the maintainer or an admin of the target repository.

What You'll Need#

Configure Jenkins Credentials#

The first step of the integration is to ensure you've added your SAUCE_USERNAME and SAUCE_ACCESS_KEY as a secret file/text in your Jenkins server (Not sure where to find these? They're here).

The easiest way to add credentials to Jenkins is with the UI:

  • Log in to Jenkins

  • Go to Manage Jenkins > Manage Credentials

  • Next to (Global), select Add credentials

    Add Jenkins Credentials
  • For Kind, select Secret Text

  • Enter the following information:

    • Scope: Global
    • Secret: 'your-sauce-username'
    • ID: 'sauce-username'
    • Description: Sauce Labs Username
  • Repeat the above steps for your Sauce Labs Access Key

    Jenkins Secrets

    For further information on how to store your Sauce Labs credentials in Jenkins, visit the Jenkinsfile documentation.

Configure the Jenkins Pipeline#

Add the Jenkinsfile at the root of your project directory so that Jenkins can detect changes and run saucectl accordingly. In the examples below, the environment variables are the GitHub secrets configured in Jenkins:

.jenkins/Jenkinsfile.cypress
loading...
See full example on GitHub

You can view some of our public examples here.

Now you can commit these files and Jenkins will detect the new pipeline and launch saucetl to run your tests.

For example if you're using the Blue Ocean plugin, your output may look something like this:

GitHub Settings
Last updated on by James Tacker