What is the most challenging aspect of running automation tests? Anshul Sharma believes it is covering multiple browsers and cross-device testing combined with faster execution of tests. One way to do this is parallel execution of tests concurrently over a Selenium Grid, but that comes with a substantial burden of managing and maintaining the platforms and browsers. Now that cloud-computing resources are available and affordable, an alternative is leveraging the cloud. Moving to the cloud makes tests easier and faster to run for several reasons. First, no installing/upgrading the browser versions, Selenium version, or antivirus on the servers. Second, the low cost of adding more servers to provide test support as new products are launched into the market. Third, easier debugging, including identifying the tests that failed due to actual faults or to a browser problem. Learn how to set up and run the automated test on multiple browsers and platform using Java, Selenium with Sauce Labs, and how to run the application behind a firewall.
4. 5/31/16
2
• Introduc2on to Selenium Webdriver
• Introduc2on to Selenium Grid
• Need for Selenium Grid
• Problem with running Selenium Grid
• Benefits of moving to cloud plaNorm from grid
• Introduc2on to cloud plaNorm- Sauce Labs
• Advantages of moving towards cloud plaNorm
• Demo
• Q & A
Agenda
2016 3
What is Selenium Webdriver
• Selenium is a web
API which drives
interac2on with
browser
• Repeatable tasks to
be automa2c rather
than doing it manual
2016 4
6. 5/31/16
4
Need for Selenium Grid
• Selenium Grid gives the flexibility to distribute your test cases for
execu2on.
• Reduces batch processing 2me.
• Mul2 browser and plaNorm tes2ng.
• Device tes2ng.
2016 7
Problems with running Selenium Grid
• High Maintenance
• Cost
• Flakiness
2016 8
8. 5/31/16
6
Running things behind firewall- Sauce Connect
2016 11
Moving things on cloud using Sauce Labs
private static DesiredCapabilities capability = new DesiredCapabilities();
if (browserName != null)
capability.setCapability(CapabilityType.BROWSER_NAME, browserName);
if (version != null)
capability.setCapability(CapabilityType.VERSION, version);
if (platform != null)
capability.setCapability(CapabilityType.PLATFORM, platform);
if (jobName != null)
capability.setCapability("name", jobName);
driver = new RemoteWebDriver(new URL(UtilConstants.SAUCE_URL), capability);
h"p://<SAUCE_USERNAME>:<API_ACCESS_KEY>@ondemand.saucelabs.com:80/wd/hub")
2016 12
9. 5/31/16
7
ImplemenHng Cloud Using Sauce Labs
2016 13
Random generated combo of number and
alphabets (32 digit) anshulsharma
Ø Used to login to your sauce labs
account
Ø Run tests against your account
Ø Upload resources to Sauce Storage
Ø Downloads test results, videos and logs
Running test on local using Sauce Labs
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" parallel="false">
<test name="Amazon_Search_Test">
<parameter name="browser" value="Chrome" />
<parameter name="version" value="36" />
<parameter name="platform" value="Windows" />
<parameter name="jobName" value="Amazon Search Test" />
<classes>
<class name="testSuite.AmazonTest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
2016 14
10. 5/31/16
8
Advantages moving towards cloud
• Automa2ng more vs managing more
• Less coding more results
• Speeding up development
• Be;er user control and debugging
2016 15
Contact me @: asharma@emmisolu2ons.com
For Source code reference: h;ps://wiki.saucelabs.com/
2016 16