+ All Categories
Home > Software > Continuous Testing in the Cloud

Continuous Testing in the Cloud

Date post: 28-Aug-2014
Category:
Upload: sauce-labs
View: 2,483 times
Download: 0 times
Share this document with a friend
Description:
Come explore how you can create a full Continuous Integration solution entirely in the Cloud using GitHub, Selenium, Sauce Labs, and Travis CI. We'll show you how you can take advantage of these hosted development resources to improve the velocity of your releases and increase application quality demanded by your users.
Popular Tags:
21
Continuous Testing in the Cloud Using Selenium, Sauce Labs, GitHub, and Travis- CI
Transcript
Page 1: Continuous Testing in the Cloud

Continuous Testing in the Cloud

Using Selenium, Sauce Labs, GitHub, and Travis-CI

Page 2: Continuous Testing in the Cloud

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 3: Continuous Testing in the Cloud

Our Continuous Integration Process1. Create automated functional tests with Selenium

2. Our functional tests will run on Sauce Labs’ hosted browsers

3. Push our code changes to our hosted repository in GitHub

4. Our pushes will trigger a build run by the Travis-CI service which will run our tests on Sauce

Page 4: Continuous Testing in the Cloud

Using Selenium for our Tests

Page 5: Continuous Testing in the Cloud

What is Selenium?“Selenium, also known as Selenium 2 and WebDriver, is a UI automation toolkit used by software developers and QA engineers to test their web application on different web browsers. ”

— Satya Avasarala, Selenium WebDriver Practical Guide

Page 6: Continuous Testing in the Cloud

Working with Selenium Tests

WebDriver driver = new FirefoxDriver();driver.get("https://www.google.com/");driver.findElement(By.id("gbqfq")).click();driver.findElement(By.id("gbqfq")).sendKeys("sauce labs");

Selenium interacts with browser apps, like this Google search:

Page 7: Continuous Testing in the Cloud

Demo

Page 8: Continuous Testing in the Cloud

Using Sauce for our Test Runs

Page 9: Continuous Testing in the Cloud

Sauce supports just about any platform you need for your test runs!

Page 10: Continuous Testing in the Cloud

Configuring Tests for Sauce WebDriver driver = new FirefoxDriver();driver.get("https://www.google.com/");driver.findElement(By.id("gbqfq")).click();driver.findElement(By.id("gbqfq")).sendKeys("sauce labs");

RemoteWebDriver driver = new RemoteWebDriver(new URL(“http://user:[email protected]:80/wd/hub”),caps);

DesiredCapabilities caps = new DesiredCapabilities();caps.setCapability("browserName", “firefox");caps.setCapability("version", "22");caps.setCapability("platform", "LINUX");

For Sauce we replace the standard WebDriver with RemoteWebDriver:

Selenium interacts with browser apps, like this Google search:

And then we add our desired browser and platform:

Page 11: Continuous Testing in the Cloud

Demo

Page 12: Continuous Testing in the Cloud
Page 13: Continuous Testing in the Cloud

Using GitHub for our Project

Page 14: Continuous Testing in the Cloud

What is GitHub?“GitHub is a web-based hosting service for software development projects that use the Git revision control system. GitHub offers both paid plans for private repositories, and free accounts for open source projects. ”

— http://en.wikipedia.org/wiki/GitHub

Page 15: Continuous Testing in the Cloud
Page 16: Continuous Testing in the Cloud

Using Travis for our Builds

Page 17: Continuous Testing in the Cloud

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 18: Continuous Testing in the Cloud

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 19: Continuous Testing in the Cloud

language: java

jdk:- oraclejdk7

env: global: - secure: HOTmOq6r+fjDDvr7gzETG7rS9IQtZ7QQ= - secure: NFM+4hE1VdaGs/lhaiVdn9Vi9P5L8Nb2t=

addons: sauce_connect: true

.travis.yml example

Page 20: Continuous Testing in the Cloud

Configuring GitHub for Travis

git add .travis.yml

git push origin master

..and commit our changes

Now we add our Travis config file to our GitHub project:

READY TO BUILD!!!

Page 21: Continuous Testing in the Cloud

Q&A


Recommended