Automated Web Testing with Selenium



Similar documents
Automated Web Testing Erik Doernenburg ThoughtWorks

SpiraTest / SpiraTeam Automated Unit Testing Integration & User Guide Inflectra Corporation

Continuous Integration

Domain Specific Languages for Selenium tests

Web Applications Testing

Selenium Automation set up with TestNG and Eclipse- A Beginners Guide

Selenium An Effective Weapon In The Open Source Armory

Automation using Selenium

STUDY AND ANALYSIS OF AUTOMATION TESTING TECHNIQUES

Software Automated Testing

}w!"#$%&'()+,-./012345<ya

Certified Selenium Professional VS-1083

Windmill. Automated Testing for Web Applications

Agile Web Application Testing

Test Automation Selenium WebDriver using TestNG

Regression & Load Testing BI EE 11g

Introduction to Selenium Using Java Language

Exploring Web Testing Tools For Use In A Classroom

BDD FOR AUTOMATING WEB APPLICATION TESTING. Stephen de Vries

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

Progressive Enhancement With GQuery and GWT. Ray Cromwell

Software Development Tools

Installation Guide. Before We Begin: Please verify your practice management system is compatible with Dental Collect Enterprise.

Selenium WebDriver Recipes in C#

WA2256 Responsive Mobile Web Development with HTML5, CSS3, JavaScript, and jquery Mobile. Classroom Setup Guide. Web Age Solutions Inc.

Example. Represent this as XML

Analysis and Identification of Cross Browser Inconsistency Issues in Web Application using Automation Testing

Appium mobile test automation

Magento Test Automation Framework User's Guide

ekomimeetsmage Manual for version 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0

International Journal of Advanced Engineering Research and Science (IJAERS) Vol-2, Issue-11, Nov- 2015] ISSN:

Drive. Etobicoke-Mimico Watershed Coalition

SOFTWARE TESTING TRAINING COURSES CONTENTS

Google App Engine f r o r J av a a v a (G ( AE A / E J / )

Infor Xtreme Browser References

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

New Tools for Testing Web Applications with Python

How To Sync Google Drive On A Mac Computer With A Gmail Account On A Gcd (For A Student) On A Pc Or Mac Or Mac (For An Older Person) On An Ipad Or Ipad (For Older People) On

Load Testing Ajax Apps using head-less browser tools. NoVaTAIG April 13, 2011 Gopal Addada and Frank Hurley Cigital Inc.

AUTOMATING THE WEB APPLICATIONS USING THE SELENIUM RC

Automating Testing and Configuration Data Migration in OTM/GTM Projects using Open Source Tools By Rakesh Raveendran Oracle Consulting

TESTING TOOLS COMP220/285 University of Liverpool slide 1

Livezilla How to Install on Shared Hosting By: Jon Manning

Testing Tools Content (Manual with Selenium) Levels of Testing

How do I Install and Configure MS Remote Desktop for the Haas Terminal Server on my Mac?

Automated testing of CS UI using Selenium and Python

QEx Whitepaper. Automation Testing Pillar: Selenium. Naveen Saxena. AuthOr:

How do I Install and Configure MS Remote Desktop for the Haas Terminal Server on my Mac?

Regression & Load Testing BI EE 11g

With the use of keyword driven framework, we can automate the following test scenarios for Gmail as under :-

Automatic vs. Manual Code Analysis

Selenium WebDriver. Gianluca Carbone. Selenium WebDriver 1

Mink Documentation. Release 1.6. Konstantin Kudryashov (everzet)

HowTo. Planning table online

PRiSM Security. Configuration and considerations

Testing. Chapter. A Fresh Graduate s Guide to Software Development Tools and Technologies. CHAPTER AUTHORS Michael Atmadja Zhang Shuai Richard

Installation & Configuration Guide Professional Edition

Bailey Testing Framework. An automated graphic based GUI testing framework for TDD process.

Test Automation Integration with Test Management QAComplete

SMS for Outlook. Installation, Configuration and Usage Guide

MyanPay API Integration with Magento CMS

Your Mission: Use F-Response Cloud Connector to access Google Apps for Business Drive Cloud Storage

Selenium 1.0 Testing Tools

Creating an Apple ID Account Using the Internet on a Desktop or Laptop Computer

Automated Web Software Testing With Selenium

Viewpoint. Choosing the right automation tool and framework is critical to project success. - Harsh Bajaj, Technical Test Lead ECSIVS, Infosys

WA2262 Applied Data Science and Big Data Analytics Boot Camp for Business Analysts. Classroom Setup Guide. Web Age Solutions Inc.

GLOBAL JOURNAL OF ENGINEERING SCIENCE AND RESEARCHES

WEB APPLICATION TESTING SOLUTIONS WITH SELENIUM

DESIGN OF AUTOMATION SCRIPTS EXECUTION APPLICATION FOR SELENIUM WEBDRIVER AND TestNG FRAMEWORK

Integrating LivePerson with Salesforce

WebIOPi. Installation Walk-through Macros

To Setup Your EFT Processing. To Setup Your Credit Card Processing

North Carolina Community Colleges Business Intelligence Reporting System

Redpaper Axel Buecker Kenny Chow Jenny Wong

AdRadionet to IBM Bluemix Connectivity Quickstart User Guide

FlexSim LAN License Server

Install and End User Reference Guide for Direct Access to Citrix Applications

Lecture 9 Chrome Extensions

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Dues & Billing. Dues & Billing. I. Dues and Billing Overview. Welcome to Dues and Billing!

Creating Home Directories for Windows and Macintosh Computers

F-SECURE MESSAGING SECURITY GATEWAY

The easy way to a nice looking website design. By a total non-designer (Me!)

Automating Functional Tests Using Selenium

Title: Appium Automation for Mac OS X. Created By: Prithivirajan M. Abstract. Introduction

MAGENTO THEME SHOE STORE

Customer Bank Account Management System Technical Specification Document

Ricardo Perdigao, Solutions Architect Edsel Garcia, Principal Software Engineer Jean Munro, Senior Systems Engineer Dan Mitchell, Principal Systems

Google Trusted Stores Setup in Magento

Building native mobile apps for Digital Factory

NAS 221 Remote Access Using Cloud Connect TM

SHC Client Remote Access User Guide for Citrix & F5 VPN Edge Client

Using IBM DevOps Services & Bluemix Services Part 2: Deploying an App that Uses a Data Management service

Download Google Drive to windows 7

Getting Started Developing JavaScript Web Apps. this = that. VT Geospatial Forum 2015

Development Specifications. January 14th, 2012

Remote Desktop Web Access. Using Remote Desktop Web Access

Administrator s Guide ALMComplete Support Ticket Manager

Android Developer Fundamental 1

Transcription:

Automated Web Testing with Selenium Erik Doernenburg ThoughtWorks Agenda What is Selenium? Writing Maintainable Tests

What is Selenium? Test tool for web applications Java, C#, Perl, Python, Ruby Lives at selenium.openqa.org Runs in any mainstream browser Supports tests in many languages Selenese (pure HTML, no backend required) Record/playback (Selenium IDE) Open Source with corporate backing Demo Record a test in Selenium IDE Show same test written in Java

Java Test example public void testgoogletestsearch() throws Exception { selenium.open("http://www.google.com/webhp"); assertequals("google", selenium.gettitle()); selenium.type("q", "Selenium OpenQA"); selenium.click("btng"); selenium.waitforpagetoload("5000"); assertequals("selenium OpenQA - Google Search", selenium.gettitle()); Java SetUp/TearDown example public void setup() throws Exception { selenium = new DefaultSelenium( "localhost", 4444, "*chrome", "http://www.google.com"); selenium.start(); public void teardown() throws Exception { selenium.stop();

A few Selenese commands click gethtmlsource isvisible close gettitle keypress createcookie getvalue mouseover dragdrop goback open fireevent iselementpresent refresh geteval istextpresent type Element locators ID: id=foo Name: name=foo First ID, then name: identifier=foo DOM: document.forms[ myform ].mydropdown XPath: xpath=//table[@id='table1']//tr[4]/td[2] Link Text: link=sometext CSS Selector: css=a[href= #id3 ] selenium.click("btng"); Sensible defaults, e.g. xpath if starts with //

How Selenium works Agenda What is Selenium? Writing Maintainable Tests

Standard end-user black-box test 1. Login as administrator 2. Create a user 3. Log out 4. Login as that user 5. Create a folder 6. Create a thingy in that folder 7. Search for that thingy in the search box 8. Make sure your thingy shows up on the search results page Fragile Automated Tests Exercising irrelevant features Logging in/logging out Creating a folder Creating a thingy If the UI for any one of those features changes, your search test fails

Know when to record tests Recorded tests reuse no code Record & Tweak vs. Fire and Forget Slight change in folder creator page means all of those tests have to be re-recorded from scratch Use the recorder to create reusable code Unit testing vs. Integration testing Selenium tests are integration tests Functional/Acceptance/User/Compatibility Unit tests verify a unit in isolation If FooTest.java fails, the bug must be in Foo.java Cannot fail due to browser incompatibilities Must be completely isolated from each other Integration tests verify that units work together Requires testing multiple configurations (browsers) Tend to build on the side-effects of earlier tests

Presentation Model Create a layer of classes that mimic the UI a field for every text box, etc. a method for every button Test the application flow using this model Can use normal unit test framework Insulated from design changes Use Selenium to check wiring and browser compatibility Create abstractions Tests can use all language features extract method, inheritance, public void testsearchforthingy() { createtestuserandlogin(); createthingyinfolder("foo", "Test Folder"); searchforthingy("foo"); asserttrue(ispresentinresultlist("foo")); Re-use makes tests less fragile

Use your code directly Prepare your search tests using model API FolderBean fb = new FolderBean(); fb.setparent(folderbean.root); fb.setname("foo"); fb.createnewfolder(); // adds a folder to the DB selenium.open("/search"); selenium.type("query", "foo"); selenium.click("search"); asserttrue(selenium.istextpresent("foo found"); Your tests and web app are written in same language... A class per test vs. A class per page Do create a class for each test this inherits from TestCase contains the flow of the test If the same pages are used by multiple tests create a separate hierarchy of classes, one per page inject the test into the page to access Selenium public void testworkflow() {! WelcomePage welcomepage = new WelcomePage(this);! welcomepage.selectdailyview();! DailyView dailyview = new DailyView(this);! dailyview.selectlocation("ldn");! dailyview.clickok();

JUnit vs. TestNG JUnit is opinionated software TestNG has dependsonx public void setup() { Dependencies between tests are log("setup"); explicitly prevented Separate tests are testing separate public units void testfoo() { Everything gets torn down after log("foo"); every test method Constantly starting/stopping browser public void testbar() { log("bar"); public void teardown() { log("teardown");» setup foo teardown setup bar teardown Summary Use Selenium when it makes sense when you want to reproduce a user s interaction with your application in a real web browser when you depend on the browser (AJAX) Use Selenium for Integration Testing Use the features offered by your language Do consider presentation model and HTTPUnit Use Selenium in your development environment