Introduction to
Sauce Labs
Testing your web app with every possible browser
What is Sauce Labs
Sauce Labs is a great service to test your web app with every possible browser. It provides you 300+ browsers to test against. For web developers, it provides JavaScript unit testing, manual web page testing and selenium testing. All of that is free for open source projects! They also provide mobile testing which is out of this blog post’s scope.
Sauce Labs also has a very good documentation of setting things up with different languages, testing frameworks and CI providers.
How the setup works
Sauce Connect creates a secure tunnel from your environment to Sauce Lab’s environment. After the connection has been established, virtual machine with a certain browser in Sauce Labs connects to your local environment’s server which serves the test page.
This what it looks like in practice:
Local environment or customer environment can also mean CI environment. Most of the time you just want the CI to run tests with all configured browsers in Sauce Labs, but you also might want to run tests with a certain browser from your local machine.
JS Unit testing
Sauce Labs supports Karma test runner out-of-the-box. You should first get your tests running with Karma before trying to run them in the cloud. Karma supports a lot of testing frameworks such as Mocha and Jasmine. You can also use their raw REST API to use any test runner, but it’ll probably be easier to just settle with Karma.
After your tests can be run with Karma, you can setup karma-sauce-launcher to run the tests with Sauce Lab’s browsers. You can see a working example configuration in ProgressBar.js repository.
Manual testing
I don’t see that much benefit of the manual testing but it’s good for just testing if your page works at all in a certain browser
Alternatives
- Browserstack — Pretty much same as Sauce Labs, looks promising.
- Browserling — Manual browser testing.
- Testling — JS unit testing. No mobile browsers. Documentation isn’t so good. No selenium tests.