Manual testing with Sauce Labs and WonderProxy
Combine WonderProxy's global network with Sauce Labs' platform for fast and effective testing.
Overview
When you test your geoIP websites and applications with WonderProxy, you probably verify things on a few browsers, maybe even on more than one operating system. You're probably not testing exhaustively, though, because who has the time?
Sauce Labs is a paid service that enables you to test applications on virtually infinite (actually >1,000) combinations of browsers, operating systems, and devices. WonderProxy provides a global network of proxy servers that you can use to ensure that your localized applications are behaving properly around the world. With Sauce Labs and WonderProxy, you can run your geoIP testing through all of the browser-operating system-hardware combinations that you care about, from all of the locales that you care about. Delightful!
In this tutorial, you will learn how to set up Sauce Labs and Sauce Connect to work with WonderProxy to run your manual tests.
Prerequisites
This tutorial requires that you have a Sauce Labs account. To use the Sauce Connect command-line tool, you will also need to retrieve your Sauce Labs Access Key from the Sauce Labs User Settings page.
At WonderProxy, proxy tokens replace passwords in your server credentials. Proxy tokens are quick to generate and work instantly across the network. Generate one (or five), and then use them anywhere your proxy configuration asks for a password.
Proxy tokens are part of our Delegated Authentication system.
In order for the WonderProxy demo code to work, export your Sauce Labs and WonderProxy credentials as environment variables, as in the following:
export SAUCE_USERNAME="yourSauceUsername"
export SAUCE_ACCESS_KEY="the-access-key-from-your-account"
export WONDERPROXY_USER="wonderProxyUsername"
export WONDERPROXY_TOKEN="wonderProxyProxyToken"
This also makes it easier to use Sauce Labs' Sauce Connect tool directly if you choose not to use our scripts.
Procedure
Sauce Labs' Sauce Connect is a tool designed to let the Sauce Labs platform access servers that aren't accessible on the public internet by creating a secure tunnel between a local network and Sauce's test platform. As a side benefit, Sauce Connect supports using an authenticated HTTP proxy for its connections — in this case, WonderProxy servers!
You will create a tunnel for each WonderProxy location through which you want to test and point locale-specific tests at the corresponding tunnel. When you run your tests, Sauce Connect will route the tests through the proxies.
ping
, or through
our API. Managing multiple Sauce Connect tunnels can be complicated, so WonderProxy provides two helper scripts to open and close Sauce Connect tunnels.
Step 1: Set up Sauce Connect.
- To get started, download the Sauce Connect executable from Sauce Labs.
-
Open a Sauce Connect tunnel. You can either do this
directly using
sc
or use the WonderProxy helper scripts.-
Use
sc
directly: runsc
, specifying the relevant proxy details in your command-line arguments, as in the following:$ sc --user "$SAUCE_USERNAME" \ --api-key "$SAUCE_ACCESS_KEY" \ --proxy "telaviv.wonderproxy.com:11000" \ --proxy-userpwd "$WONDERPROXY_USER:$WONDERPROXY_TOKEN" \ --tunnel-identifier telaviv \ --se-port 4445 \ --scproxy-port 56692 \ --pidfile telaviv.pid \ --logfile telaviv.log
Refer to the Sauce Connect documentation for more information about each parameter.
If you plan to run more than one tunnel from the same host computer, be sure to change the
--proxy
,--tunnel-identifier
,--se-port
,--scproxy-port
,--pidfile
, and--logfile
arguments. -
Use WonderProxy helper scripts:
To use our helper scripts, the
sc
binary must be in your environment$PATH
variable. On most Linux and Mac systems, you can do that by copyingsc
into your/usr/local/bin
directory.sauce_connect.sh
creates one Sauce Connect tunnel for every WonderProxy server specified in the argument list. The following example creates Sauce Connect tunnels through WonderProxy's Tel Aviv, Vancouver, and Albuquerque proxy servers.$ ./sauce_connect.sh telaviv vancouver albuquerque Starting a Sauce Connect tunnel for telaviv in the background. Check /tmp/sauce-connect/telaviv.* for logs and output. When you are ready to stop the telaviv tunnel, kill 88299 Starting a Sauce Connect tunnel for vancouver in the background. Check /tmp/sauce-connect/vancouver.* for logs and output. When you are ready to stop the vancouver tunnel, kill 88303 Starting a Sauce Connect tunnel for albuquerque in the background. Check /tmp/sauce-connect/albuquerque.* for logs and output. When you are ready to stop the albuquerque tunnel, kill 88307 Tunnels are spinning up, this may take a few seconds... ........................... telaviv is ready vancouver is ready albuquerque is ready
-
Use
The Sauce Labs dashboard displays all of your open tunnels. The Dashboard menu shows the number of active tunnels, and you can select the Tunnels menu item to see details about each tunnel:
Step 2: Link a manual test to a Sauce Connect tunnel
Now that your tunnels are up and running, you can start testing!
- From the Sauce Labs dashboard, select Manual tests.
- Specify a starting URL and a platform.
- At the bottom of the page, choose a Sauce Connect tunnel:
- Click the Start session button.
Step 3: Test!
Sauce will automatically load up your starting URL, and you will be able to interact directly with the browser and platform. Since you started the session with a Sauce Connect tunnel proxying through one of WonderProxy's servers, you'll see the same results that somebody browsing normally from that location would see!
Step 4: Clean up
When you're done testing, you can close your Sauce Connect tunnels from
the Sauce Labs dashboard,
or by terminating the sc
process with Ctrl-C
.
Alternatively, if you used sauce_connect.sh
to open the
tunnels, you can use
sauce_disconnect.sh
to close them. Specify each tunnel to close in the argument list. The
following example closes the Tel Aviv, Vancouver, and Albuquerque Sauce
Connect tunnels.
./sauce_disconnect.sh telaviv vancouver albuquerque
Killing Sauce Connect tunnel for telaviv, PID 88299
Killing Sauce Connect tunnel for vancouver, PID 88303
Killing Sauce Connect tunnel for albuquerque, PID 88307