14
Web and Mobile Web Automation using Web and Mobile Web Automation using Selenium And Sauce Selenium And Sauce Presented By B.K.Venkata. Uday Kumar

Test automation using Selenium Sauce

Embed Size (px)

Citation preview

Page 1: Test automation using Selenium Sauce

Web and Mobile Web Automation usingWeb and Mobile Web Automation usingSelenium And Sauce Selenium And Sauce

Presented ByB.K.Venkata. Uday Kumar

Page 2: Test automation using Selenium Sauce

1.1. Overview of Sauce Cloudified ServicesOverview of Sauce Cloudified Services

2.2. Usage of Sauce -Interactive SessionUsage of Sauce -Interactive Session

3.3. Usage of Sauce –Script ModeUsage of Sauce –Script Mode

4.4. Integration of Selenium2 and Sauce ServicesIntegration of Selenium2 and Sauce Services

5.5. About Sauce ConnectAbout Sauce Connect

6.6. Dashboard –Sauce Dashboard –Sauce

7.7. Features of Sauce CloudFeatures of Sauce Cloud

8.8. Advantages & Disadvantages of this ApproachAdvantages & Disadvantages of this Approach

9.9. Reference'sReference's

OverviewOverview

Page 3: Test automation using Selenium Sauce

Overview of Sauce Cloudified ServicesOverview of Sauce Cloudified Services

Sauce On Demand is a cloud-based service that allows you to run automated cross-

browser functional tests at high speeds in parallel, so you don't need to maintain testing

infrastructure.

Easy-to-use tools let you build both manual and automated tests that

produce media-rich results, including screen shots and videos of bugs that can be

added to any bug tracking system.

Sauce Support 65+browser and OS combination .

•Operating Systems like Windows, Linux, Mac ,

•Browsers like Internet Explorer, Chrome, Firefox, Safari, Opera, IPhone, Ipad,

Android

• All latest browsers versions are available.

Page 4: Test automation using Selenium Sauce

Usage of Sauce -Interactive SessionUsage of Sauce -Interactive Session

Login to the Sauce On Demand is a cloud-based service .Select “New Interactive Session” button in Dashboard Page.

Page 5: Test automation using Selenium Sauce

Usage of Sauce –Script ModeUsage of Sauce –Script ModeUnit Test mode

SETUPStep 1: Get Python.(Download from python.org)Step 2: Add Python to your PATH.Right click on "My Computer". Select "Properties" from the context menu. In the "System Properties" dialog box, click on the "Advanced" tab. Click on the "Environment Variables" button. Highlight the "Path" Variable in "System variables" section. Click the "Edit" button. Append the following lines to the text inside the "Variable value" text box semi-colon delimited: C:\Python25\;C:\Python25\Scripts\ Click "OK" on the "Edit System Variable" dialog box then "OK" on the "Environment Variables" dialog box to commit the changes.Step 3: Install setuptools Download ez_setup.py Open the cmd console, cd into the directory where the ez_setup.py file was saved and run: python ez_setup.py Step 4: Get Selenium easy_install -U selenium

Page 6: Test automation using Selenium Sauce

Usage of Sauce –Script ModeUsage of Sauce –Script ModeCode

import unittestfrom selenium import webdriverclass Selenium2OnSauce(unittest.TestCase): def setUp(self): desired_capabilities = webdriver.DesiredCapabilities.IPHONE desired_capabilities['version'] = '5.0' desired_capabilities['platform'] = 'MAC' desired_capabilities['name'] = 'Testing Selenium 2 in Python at Sauce’ self.driver = webdriver.Remote( desired_capabilities=desired_capabilities, command_executor="http://USERNAME:[email protected]:80/wd/hub" ) self.driver.implicitly_wait(30) def test_sauce(self): self.driver.get('http://saucelabs.com/test/guinea-pig') self.assertTrue("I am a page title - Sauce Labs" in self.driver.title); self.driver.find_element_by_id('comments').send_keys('Hello! I am some example comments. I should appear in the page after you submit the form') self.driver.find_element_by_id('submit').click() comments = self.driver.find_element_by_id('your_comments') self.assertTrue('Your comments: Hello! I am some example comments. I should appear in the page after you submit the form' in comments.text) body = self.driver.find_element_by_xpath('//body') self.assertFalse('I am some other page content' in body.text)def tearDown(self): print "Link to your job: https://saucelabs.com/jobs/%s" % self.driver.session_id self.driver.quit()

if __name__ == '__main__': unittest.main()

Page 7: Test automation using Selenium Sauce

Integration of Selenium2 and Sauce ServicesIntegration of Selenium2 and Sauce Services

Sauce support Selenium2 scripts and can compatible with multiple programming languages like Java, Python, NodeJs, Perl.

Here, we are using python language for Integration and Functional Test Automation (Selenium2 with python bindings).

Steps to Follow:

1. A Python File is written, which will take browsers Name, OS and browser version as run time arguments.

2. The Script reads the inputs and invokes the Sauce browser with the given OS and browser combination in Sauce Cloud.

3. On invoking the Selenium2 functional script the tests will get executed in the Sauce Cloud.

4. Here we used HtmlTestRunner(unit test module for python) for maintaining test sutie.

5. The test results can be captured from Sauce or from Html Test Report( which will be generated using HtmlTestRunner).

Page 8: Test automation using Selenium Sauce

Integration of Selenium2 and Sauce ServicesIntegration of Selenium2 and Sauce Services

Python ScriptJENKIN

Sauce Cloud

Connectivity

Selenium Test Script

A Job running python script with arguments

Test Reports

Page 9: Test automation using Selenium Sauce

About Sauce ConnectAbout Sauce Connect

WHAT IS SAUCE CONNECT? Sauce Connect securely proxies browser traffic between Sauce Labs' cloud-based VMs and your local servers. Connect uses ports 443 and 80 for communication with Sauce's cloud.

WHY SAUCE CONNECT?Sauce Connect helps to do HTML Layout Testing. This can be used by both Front End designers and Testers for performing manual compatibility testing.

HOW TO USE SAUCE CONNECT?1.Download Sauce Connect.jar file from the Sauce labs site.2.Run the Jar as below java -jar Sauce-Connect.jar YOUR-SAUCE-USERNAME YOUR- SAUCE-API-KEY3.Login to the Sauce Labs web site using valid user credentials .4.Select “New Interactive Session”5.Browse the url`s (we can use the localhost url`s as well).

Page 10: Test automation using Selenium Sauce

Dashboard - SauceDashboard - Sauce

Page 11: Test automation using Selenium Sauce

Features of Sauce CloudFeatures of Sauce Cloud

Developer Tools in Every BrowserSelenium RC & WebDriver CompatibleVideo Recordings of Every TestTest Local and Firewalled ServersAny Programming LanguageBrowsers and Mobile Emulators

Page 12: Test automation using Selenium Sauce

Advantages & Disadvantages of this ApproachAdvantages & Disadvantages of this Approach

1. Easy to Integrate with Continuous Integration and Selenium2 test scripts.

2. Able to run the Parallel functional tests, which helps to optimize the test execution Time.

3. Supports multiple browsers and OS combination including mobile browsers.

4. By using this approach, we can perform Functional, Layout, Compatibility testing.

5. Sauce, in built support of Video recording and Screenshot capturing is very helpful and good.

6. Availability of updated Browsers and Versions.7. Secure Tunnel system.

Advantages :

Dis Advantages:

1. Issues with Corporate Proxy environment.

Page 13: Test automation using Selenium Sauce

ReferencesReferences:

http://saucelabs.com/features

http://www.cloudbees.com/platform-service-saucelabsondemand.cb

http://saucelabs.com/features

http://www.cloudbees.com/platform-service-saucelabsondemand.cb

Page 14: Test automation using Selenium Sauce

Thank YouThank You