Skip to main content

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

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

  1. Log in to Jenkins.

  2. Under Manage Jenkins, click Manage Credentials.

  3. Next to (global), click Add credentials.

    Add Jenkins Credentials
  4. For Kind, select Secret Text.

  5. Enter the following information:

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

    Jenkins Secrets
    note

    For further information on how to store your Sauce Labs credentials in Jenkins, see Handling credentials.

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:

v1/Jenkinsfile
loading...

Run the Pipeline Tests

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

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

GitHub Settings