Skip to end of metadata
Go to start of metadata

Developing apps on localhost is quick and efficient. The drawback is that localhost is not a publicly-accessible address on the Internet, so the browsers in the Sauce Labs cloud can't load and test your app. The solution is to use Sauce Connect ProxySauce Connect is an application that creates a secure tunnel connection between the Sauce Labs virtual machine that runs your test and your local  network. You can also use Sauce Connect to test applications and websites that are located within your corporate firewall. Sauce Connect is not required to run tests on Sauce Labs, only in situations where the application or website you want to test is not publicly accessible. 

The Jenkins plugin for Sauce automatically installs Sauce Connect on your Jenkins server, but you will need to configure your project to use it. There are also global and per-project configuration options for Sauce Connect. 

Configuring Your Project to Use Sauce Connect 

  1. Go to your project in Jenkins.
  2. In the left-hand navigation, select Configure
  3. Under Build Environment, select Sauce OnDemand Support
    This will open up a section for Sauce Labs Options.  
  4. Select Enable Sauce Connect?
    After you make this selection, a new Sauce Connect tunnel will launch whenever Jenkins starts a build for the project. 

    SELENEIUM_HOST and SELENIUM_PORT Environment Variables

    If you enable Sauce Connect for your project, then the environment variables for SELENIUM_HOST and SELENIUM_PORT will be set to localhost:4445.

Changing the Default Location of the Sauce Connect Binary

When you run a Jenkins build with Sauce Connect enabled, the default behaviour of the plugin is to extract the Sauce Connect binary that is appropriate for your operating system to your home directory. You can change the location where the plugin extracts Sauce Connect for specific projects, or at the global level for all projects. Note that Sauce Connect should always run on the same network as the site or application under test, but does not have to be on the same machine.

Changing the Global Default Location

  1. In Jenkins, go to the Administration page.
  2. Click Manage Jenkins.
  3. Click Configure System.
  4. Under Sauce Support, enter the default location for Sauce Connect in the Override Sauce Connect Path field.

Changing the Per-Project Default Location

  1. In Jenkins, go to your project.
  2. Select Configure.
  3. In the Sauce Connect Advanced Options section, click Advanced.
  4. Enter the default location for Sauce Connect for this project in the Sauce Connect Binary Location field.

Setting Sauce Command Line Options

There are a number of command line options you can use with Sauce Connect, which you can configure to execute at both the global level and on a per-project basis when Sauce Connect launches. 

Setting Global Sauce Connect Command Line Options

  1. In Jenkins, go to the Administration page.
  2. Click Manage Jenkins.
  3. Click Configure System.
  4. Under Sauce Support, enter the command line options you'd like to use in the Sauce Connect Options field.

Setting Per-Project Sauce Connect Command Line Options

  1. In Jenkins, go to your project.
  2. Select Configure.
  3. In the Sauce Connect Advanced Options section, click Advanced.
  4. Enter the command line options you'd like to use in the Sauce Connect Options field.

Launching Sauce Connect on the Jenkins Slave Node

Another advanced option is launching Sauce Connect on the Jenkins slave node that is executing the build, rather than on the Master node.

  1. In Jenkins, go to your project.
  2. Select Configure.
  3. In the Sauce Connect Advanced Options section, click Advanced.
  4. Select Launch Sauce Connect on Slave.

Creating a new unique Sauce Connect tunnel per build

If you select thespin up a unique tunnel identifier for each build and populate a TUNNEL_IDENTIFIER environment variable. You must then reference this variable in the desired capabilities for your tests.
  • No labels