Web Test Automation with Selenium


Published on

This presentation covers an introduction to Selenium, the Open Source, cross browser, cross platform functional testing tool. The talk emphasized the importance of applying the same principles to testing (abstraction, refactoring, DRY) that development teams apply to developing software. (This presentation was used for a talk at the Asian Testing Conference)

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Web Test Automation with Selenium

    1. 1. Web Test Automation with Selenium Vivek Prahlad
    2. 2. Agenda <ul><ul><li>Introduction to Selenium </li></ul></ul><ul><ul><li>Demo </li></ul></ul><ul><ul><li>An overview of the framework, and how it works </li></ul></ul><ul><ul><li>Showcase the different ways of using Selenium </li></ul></ul><ul><ul><ul><li>FIT style tables </li></ul></ul></ul><ul><ul><ul><li>Selenium Remote Control (RC) </li></ul></ul></ul><ul><ul><li>Limitations of Selenium </li></ul></ul>
    3. 3. What is Selenium? <ul><ul><li>A JavaScript based </li></ul></ul><ul><ul><li>Open Source </li></ul></ul><ul><ul><li>Web testing tool </li></ul></ul><ul><ul><li>That supports testing Web 2.0 applications </li></ul></ul><ul><ul><li>On multiple browsers </li></ul></ul><ul><ul><li>And multiple Operating Systems </li></ul></ul>
    4. 4. Quick Demo
    5. 5. Overview <ul><ul><li>History: originated from TW Time Sheet application </li></ul></ul><ul><ul><li>Extremely popular Open Source Web testing tool </li></ul></ul><ul><ul><li>Can be used for Acceptance / Functional testing </li></ul></ul><ul><ul><li>Can be used for reproducing bugs </li></ul></ul>
    6. 6. Using Selenium <ul><ul><li>Bot mode: Selenium Core </li></ul></ul><ul><ul><ul><li>HTML Tables </li></ul></ul></ul><ul><ul><li>Driven mode: Selenium Remote Control (RC) </li></ul></ul><ul><ul><ul><li>Test cases in language of choice </li></ul></ul></ul><ul><ul><li>Record mode: Selenium IDE </li></ul></ul>
    7. 7. Architecture
    8. 8. Table or driver based? <ul><ul><li>Table based approach fine for simple tests. </li></ul></ul><ul><ul><ul><li>No programming required </li></ul></ul></ul><ul><ul><ul><li>Doesn't scale – duplication is a major issue. </li></ul></ul></ul><ul><ul><li>Driver approach better for 'Real' test suites </li></ul></ul><ul><ul><ul><li>Can develop tests in language of choice: </li></ul></ul></ul><ul><ul><ul><li>C#, Java, Ruby, Python, Perl </li></ul></ul></ul><ul><ul><ul><li>Easier data management via DB / Excel </li></ul></ul></ul>
    9. 9. Maintaining Test Suites <ul><ul><li>Test code is just like production code! </li></ul></ul><ul><ul><li>Needs refactoring, abstraction </li></ul></ul><ul><ul><li>API for the application </li></ul></ul><ul><ul><li>Can build tests from API building blocks </li></ul></ul><ul><ul><li>Try to maintain meaning – in test names, variable names, comments, and suite organization </li></ul></ul>
    10. 10. Evolving Test Suites <ul><ul><li>Do your test suites break as the app evolves? </li></ul></ul><ul><ul><li>The importance of DRY: Don't Repeat Yourself </li></ul></ul><ul><ul><li>Minimize changes to test suite as app changes </li></ul></ul><ul><ul><li>Avoid redoing / reworking entire test suites </li></ul></ul><ul><ul><li>Avoiding duplication simpler for test code: test steps execute sequentially </li></ul></ul><ul><ul><li>Methods, parametrization </li></ul></ul><ul><ul><li>To some extent, Object Orientation </li></ul></ul>
    11. 11. Demo: Refactoring Tests
    12. 12. Ajax support <ul><ul><li>Selenium supports testing Web 2.0 applications </li></ul></ul><ul><ul><li>Monitor the DOM for completion of Async calls </li></ul></ul><ul><ul><li>waitForCondition() </li></ul></ul><ul><ul><li>waitForValue() </li></ul></ul>
    13. 13. Continuous Integration <ul><ul><li>Run Selenium tests as part of the build </li></ul></ul><ul><ul><ul><li>Works with both Core and Driven modes </li></ul></ul></ul><ul><ul><ul><li>(Each time a developer checks in, if necessary) </li></ul></ul></ul><ul><ul><li>Can generate HTML reports, published to entire team </li></ul></ul><ul><ul><li>Helps catch bugs ASAP </li></ul></ul><ul><ul><ul><li>Addresses risk of catching bugs late in the cycle </li></ul></ul></ul>
    14. 14. Limitations <ul><ul><li>Most limitations valid if using Selenium Core: </li></ul></ul><ul><ul><ul><li>Alerts </li></ul></ul></ul><ul><ul><ul><li>“ Same Origin Policy” </li></ul></ul></ul><ul><ul><ul><li>File uploads </li></ul></ul></ul>
    15. 15. Summary <ul><ul><li>Selenium is a testing framework for Web Applications </li></ul></ul><ul><ul><li>Drivers allow web testing in language of choice </li></ul></ul><ul><ul><li>Test scripts are code: need maintenance, refactoring </li></ul></ul><ul><ul><li>Limitations of Selenium </li></ul></ul>
    16. 16. Thank You! <ul><ul><li>Check out Selenium at: http://www.openqa.org/selenium </li></ul></ul><ul><ul><li>Questions? </li></ul></ul>