Open Source Web Test Automation Tools Using Selenium as an alternative to traditional vendor tools By Martin Lienhard [email protected]
Open Source Web Test Automation Tools
Using Selenium as an alternative to traditional vendor tools
By Martin [email protected]
Open source tools• Open source tools such as Selenium and Watir are changing the way the
world automates testing• In the past open source test tools were isolated to development and unit
testing• In the past the limitations of open source tools made them impractical for
the QA test community• Vendor tools have always been the 1st choice by the QA test community• Over the past several years open source tools have matured to a level
where they now rival the vendor tools• With organizations progressing towards Agile methodologies vendor tools
have fallen behind and open source tools are excelling
What is Selenium
• Selenium is a suite of Web application test automation tools for any browser on any operating system– Firefox, Internet Explorer, Safari, Opera, Chrome– Windows, OS X, Linux, Solaris
• Selenium is broken up into 4 primary components– Selenium Core– Selenium IDE– Selenium RC– Selenium Grid
• http://seleniumhq.org
Selenium Core
• Selenium Core was developed for an internal application at ThoughtWorks
• The Core is written in JavaScript, so it runs directly in the browser
• Tests run directly on the application web server• Selenese is a command language written into HTML tables
Command Target Value
Selenium IDE• Selenium IDE (Integrated Development Environment)• The IDE is a record and playback tool with built-in debugger and editor• The IDE is an add-on for Mozilla Firefox only• The IDE automatically creates test scripts in the Selenese HTML table
format• The IDE can generate code into a wide variety of languages and test
frameworks– HTML Selenese, C#, Java, Perl, PHP, Python, Ruby– Bromine, JUnit, NUnit, RSpec, Test::Unit, TestNG, unittest
Selenium IDE
Selenium RC• Selenium RC (Remote Control)• The RC is a server that launches and kills browsers, and acts as an
HTTP proxy for web requests from them• The RC contains client libraries for several popular languages
– C#, Java, Perl, PHP, Python, Ruby• The RC can be used by any testing framework that supports the
languages in the client libraries• The RC is written in Java for portability and is executed from the
command line
Selenium RC
Selenium Grid• The Grid distributes your tests on multiple machines so that you can run
your tests in parallel– Tests can be ran in parallel for reduced execution time– Test can be ran on various browser and operating system
combinations– Generates a collated report from all test machines
• The Grid can be run on a server farm or in the Cloud– The tests are distributed by the Hub server to multiple Selenium RC
machines– The tests can be ran by various Cloud computing services such as
Amazon EC2, Sauce Labs, BrowserMob, and PushToTest– The Grid is written in Java for portability and is executed from the
command line
Selenium Grid
Why choose Selenium?• The Selenium client libraries can be imported into most popular language
IDE’s– Eclipse, NetBeans, Visual Studio .NET, etc.– Reuses existing unit testing frameworks– Integrated into Fitnesse frameworks
• Used by QA test teams for functional, regression, and user acceptance testing (UAT)
• Integration into the build process has made it easy to deploy into Continuous Integration Environments
• Used by Developers for test driven development (TDD) in the Agile and extreme programming (XP) community
Why choose Selenium?• Expanded usage by Developers into other areas
– Conversion into production monitoring and load testing– Extended hooks into Flash, Flex, and other popular technologies
• Strong support for AJAX technologies• Cross platform browser and operating system comparison testing • Run tests in parallel
– Using the Grid tests can be run in parallel across multiple RC (agent) machines from a single Hub machine
– Saves time, and runs faster
Why choose Selenium?• Selenium is FREE!
– No licensing costs, so it can be deployed to as many machines as needed in a lab or for local development
– No maintenance renewal costs• Use Cloud computing services
– If hardware is a limited, then opt to have a remote test lab in the Cloud as needed
– Amazon EC2 (functional, regression testing)– Sauce Labs (functional, regression testing)– BrowserMob (production monitoring, load testing)– PushToTest (production monitoring, functional testing, load testing)
Benefits of building a Test Framework
• Abstract low level commands– Modularize code and data
• Common codebase– Centralized/shared code on network
• Common database– Centralized/shared data on network
• Make tool agnostic– Utilize many test tools– Generic test API– Reusable test data
• Features– Simple, intuitive, human readable, configurable, extensible, scalable,
maintainable, reusable, modular, flexible, robust, rapid development, high performance
Integration with Java and .NET
Java• Object oriented
– Design and programming• TestNG/JUnit
– Common unit test framework• Ant/Maven
– Automatically build, deploy, and test application
• Bamboo/Hudson– Continuous integration– Automated test
reporting/notification
.NET• Object oriented
– Design and programming• VSUnit, NUnit, MBUnit
– Common unit test framework• TFS Build
– Automatic build verification tests (BVT)
– Continuous integration– Automated test
reporting/notification
Integration with Java and .NET
Java• Spring /Struts
– Integrates with application– Interface with Java components– Interface with Web services– Access Oracle/MySQL databases
.NET• .NET Framework
– Integrates with application– Interface with .NET components– Interface with Web services– Access SQL Server databases
Selenium demonstration
• Selenium IDE• Selenium RC• Selenium Grid