continuous testing and new tools for automation - presentation from starwest 2014
DESCRIPTION
Learn how you can create a full continuous integration solution entirely in the cloud using GitHub, Selenium, Sauce Labs, and Travis CI. Michael will show you how to take advantage of these hosted development resources to improve the velocity of your releases and provide the application quality your users demand. He will demonstrate how Sauce Labs can securely execute your Selenium tests in parallel and dramatically reduce the time required to run your critical integration and acceptance tests—so you can finally realize the promise of continuous delivery. www.saucelabs.com/signup/trialTRANSCRIPT
![Page 1: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/1.jpg)
Continuous Testing and New Tools for Automation
Using Selenium, Sauce Labs, GitHub, and Travis-CI**Presentation given at StarWest 2014
![Page 2: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/2.jpg)
How I Spent My Summer Testing
Continuous Testing on the Beach
![Page 3: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/3.jpg)
What is Continuous Integration?
“Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early.”
http://www.thoughtworks.com/continuous-integration
![Page 4: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/4.jpg)
![Page 5: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/5.jpg)
My Continuous Testing Process
1. Commit and push
2. Set up test server and env
3. Check out the code
4. Set up the test dependencies
5. Set up the test databases
6. Run the tests
7. (Optionally) deploy code
![Page 6: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/6.jpg)
Using GitHub for my Repo
![Page 7: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/7.jpg)
My Continuous Testing Process
1. Commit and push
![Page 8: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/8.jpg)
- Borrowed from Armin Ronacher Flaskr tutorial - https://github.com/mitsuhiko/flask/tree/master/examples/flaskr/
My Super Simple Demo App
![Page 9: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/9.jpg)
My Super Simple Demo App
![Page 10: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/10.jpg)
GitHub and the .travis.yml file
![Page 11: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/11.jpg)
Using Travis for my Builds
![Page 12: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/12.jpg)
What is Travis-CI?
“Travis-CI is a hosted, distributed continuous integration service used to build and test projects hosted at GitHub. Travis-CI automatically detects when a commit has been made and will try to build the project and run tests.”
— http://en.wikipedia.org/wiki/Travis_CI
![Page 13: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/13.jpg)
My Continuous Testing Process
1. Commit and push
2. Set up test server and env
3. Check out the code
4. Set up the test dependencies
5. Set up the test databases
![Page 14: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/14.jpg)
language: Python
python: - 2.7
before_script: - lots of shell scripting here for setup for apache, etc.
script: - flask --app=flaskr run &> flask.log &
Simple .travis.yml example
![Page 15: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/15.jpg)
Travis checks out the code…
![Page 16: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/16.jpg)
Dependencies and DB Setup
• Flask configuration and restart with document root and port
• SQLite setup routines create the DB and CREATE TABLE
• “pip install” runs to fetch and install various dependency packages
![Page 17: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/17.jpg)
Using Selenium for my Tests
Need help getting started with Selenium? Download the Selenium Bootcamp series here!
![Page 18: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/18.jpg)
My Continuous Testing Process
1. Commit and push
2. Set up test server and env
3. Check out the code
4. Set up the test dependencies
5. Set up the test databases
6. Run the tests
![Page 19: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/19.jpg)
My Super Simple Test Case
1.Go to index page2.Click Login link3.Select Username text field element4.Enter our username5.Select Password text field element6.Enter our password7.Click login button
![Page 20: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/20.jpg)
My Super Simple Test in Python
1.Go to index page2.Click Login menu3.Select Username text field element4.Enter our username5.Select Password text field element6.Enter our password7.Click login button
![Page 21: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/21.jpg)
A Selenium server can be installed and run in the build env via .travis.yml
![Page 22: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/22.jpg)
Using Sauce for our Test Runs
Try Sauce for free, get an account here!
![Page 23: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/23.jpg)
Running Tests on Sauce
Sauce Connect is what enables the grid to run inside the Travis env
![Page 24: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/24.jpg)
![Page 25: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/25.jpg)
Configuring Travis for Sauce
gem install travis
travis init
travis encrypt SAUCE_USERNAME=your_sauce_username --addtravis encrypt SAUCE_ACCESS_KEY=XXXXXXXXXXXXXXXXX --add
Next, initialize your project for use with Travis CI:
First, install the Travis gem locally:
We need to encrypt our credentials for safe use in GitHub:
![Page 26: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/26.jpg)
language: pythonpython: - 2.7
env: global: - secure: HOTmOq6r+fjDDvr7gzETG7rS9IQtZ7QQ= - secure: NFM+4hE1VdaGs/lhaiVdn9Vi9P5L8Nb2t=
addons: sauce_connect: true
before_script: - lots of shell scripting here for apache, etc.
script: - flask --app=flaskr run &> flask.log & - py.test -n4 --boxed example.py
.travis.yml example for Sauce Connect
![Page 27: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/27.jpg)
My Continuous Testing Process
1. Commit and push
2. Set up test server and env
3. Check out the code
4. Set up the test dependencies
5. Set up the test databases
6. Run the tests
7. (Optionally) deploy code
![Page 28: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/28.jpg)
language: pythonphp: - 2.7env: global: - secure: HOTmOq6r+fjDDvr7gzETG7rS9IQtZ7QQ= - secure: NFM+4hE1VdaGs/lhaiVdn9Vi9P5L8Nb2t=addons: sauce_connect: truebefore_script: - lots of shell scripting here for apache, etc.script: - flask --app=flaskr run &> flask.log &
deploy: - your deployment instructions go here
.travis.yml example for deployment
![Page 29: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/29.jpg)
Demo
![Page 30: Continuous Testing and New Tools for Automation - Presentation from StarWest 2014](https://reader033.vdocuments.mx/reader033/viewer/2022051609/5476daafb4af9f39378b4572/html5/thumbnails/30.jpg)
Q&A