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.
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.
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.
- Start Sauce Command Proxy from the command line, using the
--tunnel-name) flag to provide a name for the tunnel.
'bin/sc -u $TEST_OBJECT_USERNAME -k $TEST_OBJECT_API_KEY -x $TEST_OBJECT_DC --tunnel-name $TUNNEL_NAME'
TEST_OBJECT_USERNAME refers to your TestObject username.
TEST_OBJECT_API_KEY refers to your TestObject API Key.
TEST_OBJECT_DC refers to the Data Center API endpoint (see Data Center Endpoints).
TUNNEL_NAME refers to the tunnel name (see High Availability Setup).
So an example would look like this:
- US Data Center
- EU Data Center
Mac OSX/Linux Example
$ /bin/sc -u $TEST_OBJECT_USERNAME -k $TEST_OBJECT_API_KEY -x 'https://us1.api.testobject.com/sc/rest/v1' --tunnel-name test-object-rdc-tunnel-us
> \bin\sc -u %TEST_OBJECT_USERNAME% -k %TEST_OBJECT_API_KEY% -x 'https://us1.api.testobject.com/sc/rest/v1' --tunnel-name test-object-rdc-tunnel-us
Mac OSX/Linux Example
$ /bin/sc -u $TEST_OBJECT_USERNAME -k $TEST_OBJECT_API_KEY -x 'https://eu1.api.testobject.com/sc/rest/v1' --tunnel-name test-object-rdc-tunnel-eu
> \bin\sc -u %TEST_OBJECT_USERNAME% -k %TEST_OBJECT_API_KEY% -x 'https://eu1.api.testobject.com/sc/rest/v1' --tunnel-name test-object-rdc-tunnel-eu
- In your device testing script, specify the tunnel name with
tunnelIdentifierin your capabilities, as shown in this Java 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("http://us1.appium.testobject.com/wd/hub"), capabilities);
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("https://us1.appium.testobject.com/wd/hub"), capabilities);
Java Snippet: Driver Setup for EU Data Center
final AndroidDriver driver = new AndroidDriver(new URL("https://eu1.appium.testobject.com/wd/hub"), capabilities);
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.