Skip to main content

Creating Tunnels in TestObject (Legacy)


TestObject End-of-life

TestObject was discontinued on September 1, 2021. If you have any questions, please reach out to your Customer Success Manager or Sauce Labs Support.

TestObject, our legacy real device cloud platform, allows for public and private mobile device testing. By setting up Sauce Connect Proxy, you’ll have a secure tunnel for testing apps and websites on your local machine (or behind a firewall) against devices and browsers in the TestObject Real Device Cloud. You can run a high volume of tests across a broad range of real devices without compromising performance, quality, or reliability.

Connecting to real devices in TestObject through a Sauce Connect Proxy tunnel requires endpoints and authentication methods that are different from Sauce Labs. You'll need to launch an additional tunnel – separate from the one(s) you're using in Sauce Labs – so that your test code reaches the TestObject-specific real devices.

What You'll Need#


You must know your account details, including:

  • Your TestObject username and API Key
  • The Data Center endpoint associated with your geographic location (see Data Center Endpoints)

We recommend setting all of the values above as environment variables (see Using Environment Variables for Authentication Credentials). This will protect your username and API key from exposure, and keep those values stored for future convenience.

Selecting the Tunnel to Use#

Sauce Connect Proxy can have multiple tunnels running simultaneously, as described in High Availability Setup. You can select which tunnel to use in a real device test in the same way as you would any other type of automated test.

  1. Start Sauce Command Proxy from the command line, using the --tunnel-name) flag to provide a name for the tunnel.

Use the -B all flag to disable SSL bumping. Failing to use this flag will result in certificate issues. For more information, see SSL Certificate Bumping.


a. TEST_OBJECT_USERNAME refers to your TestObject username. b. TEST_OBJECT_API_KEY refers to your TestObject API Key. c. TEST_OBJECT_DC refers to the Data Center API endpoint (see Data Center Endpoints). d. TUNNEL_NAME refers to the tunnel name (see High Availability Setup).

So an example would look like this:

Mac OSX/Linux Example

$ /bin/sc -u $TEST_OBJECT_USERNAME -k $TEST_OBJECT_API_KEY -x '' --tunnel-name test-object-rdc-tunnel-us

Windows Example

> \bin\sc -u %TEST_OBJECT_USERNAME% -k %TEST_OBJECT_API_KEY% -x '' --tunnel-name test-object-rdc-tunnel-us
  1. In your device testing script, specify the tunnel name with tunnelIdentifier in your capabilities, as shown in this Java example:

Example tunnelIdentifier Java Snippet

final DesiredCapabilities capabilities = new DesiredCapabilities();    capabilities.setCapability("testobject_api_key", System.getenv("TEST_OBJECT_API_KEY"));    capabilities.setCapability("platformName", "Android");    capabilities.setCapability("platformVersion,"  "81.0");    capabilities.setCapability("deviceName", "Samsung_Galaxy_Note_5_real"); // Will only run on the specified device    capabilities.setCapability("tunnelIdentifier", "test-object-rdc-tunnel-us");final AndroidDriver driver = new AndroidDriver(new URL(""), capabilities);

TestObject Appium Endpoints#

To ensure you're testing against the correct data center, you'll need to add the correct Appium testing endpoint when you instantiate a MobileDriver in your automated test. Examples:

Java Snippet: Driver Setup for US Data Center

final AndroidDriver driver = new AndroidDriver(new URL(""), capabilities);

Java Snippet: Driver Setup for EU Data Center

final AndroidDriver driver = new AndroidDriver(new URL(""), capabilities);

Additional Support#

If your tunnel launch fails with the message "Failed to check for existing tunnels," contact our Support team to verify that you have Sauce Connect Proxy access enabled on your account.