Академический Документы
Профессиональный Документы
Культура Документы
Agenda
Introduction to Selenium Quick Demo Different ways of using Selenium Best practices with using Selenium Questions & Feedback
www.XebiaIndia.com
Quick Poll
Do you do Web Testing? Do you do automated Web Testing? Do you need to support & test your webapp on multiple browsers? Which automated web-testing frameworks do you use?
www.XebiaIndia.com
What is Selenium?
What is Selenium
Origins of Selenium
http://www.openqa.org/selenium
www.XebiaIndia.com
Selenium Modes
www.XebiaIndia.com
Selenium Modes
www.XebiaIndia.com
www.XebiaIndia.com
Selenium tests are HTML files Selenium interacts with the DOM served to browser
Selenium is agnostic of server side technology Selenium HTML language is called Selenese
www.XebiaIndia.com 10
Selenese
Selenium understands two types of HTML files (which have simple HTML tables):
Tests Test Suites
Every test is contained within a test suite Point TestRunner.html at the test suite to run it
www.XebiaIndia.com 11
www.XebiaIndia.com
12
Selenium Concepts
Element Locators : specify HTML elements Patterns : for pattern matching values Action : manipulate app state
See Demo suite Look at tests bundled with Selenium Running selenium test in slow and fast mode
www.XebiaIndia.com
14
Selenium Modes
www.XebiaIndia.com
16
Selenium IDE
Very useful tool for beginners Firefox extension which allows record/play testing paradigm
Automates commands, but asserts must be entered by hand Creates the simplest possible Locator
Based on Selenese
www.XebiaIndia.com 17
Look at firefox extension Look at various possible commands Record a test on AUT and play-back
www.XebiaIndia.com
18
Selenium Modes
www.XebiaIndia.com
19
Selenium RC Mode
www.XebiaIndia.com
20
www.XebiaIndia.com
21
Test code is just like production code Needs re-factoring, abstraction API for the application
Run Selenium tests as part of the build Can generate HTML reports, published to entire team
www.XebiaIndia.com
23
Ajax Support
Selenium supports testing Web 2.0 applications Monitor the DOM for completion of Async calls waitForCondition(script, timeout)
www.XebiaIndia.com
24
Xpath Checker
www.XebiaIndia.com
25
Use Ids wherever possible (xpaths make the tests brittle) Use data-driven tests. Use a JSP/PHP page to generate tests In order to generate unique Ids, use timestamp Use the right level of granularity
www.XebiaIndia.com 26
Continuous Integration set-ups Creating screencasts using Selenium Testing of Ajax applications
Selenium Limitations
Slow when testing all the edge cases Slow for testing fine-grained features setup and tear-down are called for each test
www.XebiaIndia.com
28
Selenium Strengths
www.XebiaIndia.com
29
Interesting Possibilities
A Server having VMWare images of various OS/browser and each submitting a report back
www.XebiaIndia.com
30
Summary
Selenium is a testing framework for Web Applications Drivers allow web testing in language of choice Test scripts are code: need maintenance, re-factoring
www.XebiaIndia.com
31
Summary
Can be used on Developer machines Most valuable when used with CI set-up Can be used to make screen casts
Tests run on real browser most people use it to test their JavaScript works predictably on all browsers
www.XebiaIndia.com 32
Summary
Can be used for unit-testing, regression testing, smoke-testing, integration and acceptance testing
www.XebiaIndia.com
33
References / Attribution
Selenium site
This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License http://creativecommons.org/licenses/by-nc-sa/3.0/
www.XebiaIndia.com
34
Feedback
mittaldeepak01@gmail.com
www.XebiaIndia.com
35