Building an Automation Framework Using Watir Open Source
Building an Automation Framework Using Watir (Open Source Tool) Aashu Chandra Head of QA and Testing Practice, Infogain Nov 13 th , 2010
Agenda • Benefits of Testing Framework • Why Watir? • Block diagram of Testing Framework • Key Features of Testing Framework • Summary Copyright Infogain Corporation, 2010 -2 -
Benefits of Testing Framework • Reduces effort to automate script • Easy to maintain • Consistent error/exception handling mechanism • Less dependence on highly skilled automation engineers Copyright Infogain Corporation, 2010 -3 -
Why Watir? • Free open source tool • Supports IE, Fire. Fox, Chrome, Safari (for Mac) • Uses Ruby programming language • Supports web applications developed using different technologies • Waits for complete page download, before starting with next test action • Ability to recognize objects using various HTML properties Refer www. watir. com for details Copyright Infogain Corporation, 2010 -4 -
Block Diagram of Watir based testing framework Copyright Infogain Corporation, 2010 -5 -
Key Features of Watir based testing framework • Re-usability • Business Scenario’s – Plug n Play • Automated publishing of Test Results • Error/Exception handling • Test Coverage tracking • Parallel run on multiple machines Copyright Infogain Corporation, 2010 -6 -
Reusability • Identify re-usable technical and business functions • Stored in well structured and well documented libraries Benefits • Consistent testing due to use of reusable existing functions • Write once, use many Copyright Infogain Corporation, 2010 -7 -
Reusability: Example Libraries Description Tool Function Library Re-usable functions that comes built-in with the tools Application Independent Technical Function Library Re-usable functions that have Db. Connect, Send. Mail, been compiled by Infogain Read. Excel. File, Write. Excel. File Application Specific Technical Functions Library Commonly used technical or basic functions that the application under test uses Copyright Infogain Corporation, 2010 -8 - Example Screen_capture, get. Static. Text. From. Window, click. Javascript. Dialog Log. Into. Application, Go. To. Home. Page, Go. To. Catalog. Module, Set. User. Preference.
Business scenario’s - Plug n Play • Plug n Play mechanism to build new business scenario’s using existing functions • Create new test scripts based on common business entities and operations • For Example: • Put. Book. In. Shopping. Cart(Book. Id) • Remove. Book. From. Shopping. Cart(Book. Id) • Check. Out. Shopping. Cart() Benefits • Quick development of an automated test script to test some specific scenarios Copyright Infogain Corporation, 2010 -9 -
Automated Publishing of Test Results • Automated framework collects and publishes test results • Notifies users of test completion via email with attached test results • Report at § Test suite level § Test step level Benefits • Automated process keeps system and team up to date on app development and testing • Can drill down to test step to identify the reason for failure of test case Copyright Infogain Corporation, 2010 -
Sample: Test Script Level results Copyright Infogain Corporation, 2010 - 11 -
Sample: Test Step Level results Copyright Infogain Corporation, 2010 - 12 -
Error/Exception handling • Screen capture when a failure happens • Provide Stack trace when an exception happens. This helps in detailed analysis Benefits • Screen capture helps convincing developers about the bug • Stack trace helps in faster trouble shooting Copyright Infogain Corporation, 2010 - 13 -
Test Coverage Tracking • Integrated with code coverage tools § Perl – Devel: : Cover (For details refer http: //search. cpan. org/dist/Devel-Cover ) § Java – Emma (For details refer http: //emma. sourceforge. net ) Benefits • Get the coverage for any test run • Helps identify which are the areas which are not well covered Copyright Infogain Corporation, 2010 - 14 -
Parallel runs on multiple machines • Automation manager helps in configuring test cases to be run on different machines • For example 300 test cases § took almost 18 hours on one machine § Now takes 6 hours on 4 machines Benefits • Reduces test execution time Copyright Infogain Corporation, 2010 - 15 -
Summary • Open Source testing tools like Watir is powerful and supports most of the web applications • Testing Framework built over Watir helps in § Speeding up automation of scripts § Reduces dependence on highly skilled automation engineers § Quickly test new business scenario’s using existing building blocks § Provides detailed inputs to developer during error/exception § Reduces execution elapsed time, by performing parallel runs § Integrates with Code coverage tools Copyright Infogain Corporation, 2010 - 16 -
Aashu Chandra Head of QA and Testing Practice, Infogain aashu. chandra@infogain. com
- Slides: 17