Post on 14-Jul-2015
Introduction to - Sajnikanth Suriyanarayanan
Presented at AlbumPrinter QA Guild on 20th Nov 2014
Contents● Why Saucelabs?● Demo script● Using Sauce to run demo script● Introduction to holmium● Running script with holmium on sauce● Questions
Why Sauce?
● Cross browser● Cross platform● Parallel testing● yada yada…
There’s also Browserstack, Browsershots, Browserling etc.
...
Let’s get our hands dirty
Demo Setup & Introsudo pip install nose selenium holmium.coregit clone https://github.com/sajnikanth/sauce-demo
● Setup○ Use local Firefox
● Test Steps○ Go to Vistaprint Corp Page○ Click on “sign in” button○ On Login Page, enter username, password and login○ Check if “Welcome message is displayed”
● Tear Down○ Quit Browser
Running Demo Script locally
python tests/selenium_vistaprint_test.py
ornosetests tests/selenium_vistaprint_test.py
Saucelabs Setup
● Register at https://saucelabs.com○ Have username handy
● Go to https://saucelabs.com/account● Get Access Key
sudo pip install sauceclient
Demo Script on Sauce● Setup
○ Check if sauce credentials are available during runtime■ Env - Windows & Chrome
○ If credentials are not available■ Use local Firefox
● Test Steps○ Go to Vistaprint Corp Page○ Click on “sign in” button○ On Login Page, enter username, password and login○ Check if “Welcome message is displayed”
● Tear Down○ Check if sauce credentials are available during runtime
■ Update results on Sauce○ Quit Browser
Running on Saucenosetests tests/selenium_vistaprint_test.py \
-cred=<ENTER SAUCE USERNAME>:<ENTER SAUCE ACCESS KEY>
● Test Steps○ Go to <URL>○ Click on “sign in” button○ Login with <username> and <password>○ Check if “Welcome message is displayed”○ Update results on Saucelabs, if possible
Demo Script with HolmiumHolmium is a plugin for nosetests; can easily create page objects
...
Demo Script with Holmium on Sauce
nosetests tests/holmium_vistaprint_test.py\
--with-holmium --holmium-browser=firefox\
--holmium-environment=http://vistaprint.com\
--holmium-remote=http://<ENTER SAUCE USERNAME>:<ENTER SAUCE ACCESS KEY>@ondemand.saucelabs.com:80/wd/hub\
--holmium-capabilities='{"platform":"OS X 10.10", "name":"vistaprint_login"}'
...
Recap
● Demo script run locally on Firefox (hard-coded)
● Demo script run on Sauce on Windows / Chrome (hard-coded)
● Demo script with holmium on Sauce on OSX / Firefox (command line parameter)
Questions?
Resources● Presentation Link - http://j.mp/introduction-to-sauce● Demo Script● Holmium● Introduction to SauceLabs by Ryan Lane● BrowserStack vs Sauce Labs
Contact● mail@sajnikanth.com