Selenium – Beyond the Page Object Pattern

Slides:



Advertisements
Similar presentations
Drybridge Consulting Party Identification Directory Installing the Microsoft Research Service IDEAlliance and Drybridge Consulting – collaborating to deliver.
Advertisements

The creation of "Yaolan.com" A Site for Pre-natal and Parenting Education in Chinese by James Caldwell DAE Interactive Marketing a Web Connection Company.
Developing Event Driven State Machine Workflows S1 S2 S3 S4 Adam Calderon Principal Engineer - Interknowlogy Microsoft MVP – C#
SharePoint Forms All you ever wanted to know about forms but were afraid to ask.
Marketing-to-Opportunity Scenario Overview
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
MICHAEL MARINO CSC 101 Whats New in Office Office Live Workspace 3 new things about Office Live Workspace are: Anywhere Access Store Microsoft.
Test Automation: Coded UI Test
Visual Scripting of XML
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
CHANGE YOUR PASSWORD Visit name] At the “Welcome to KaplanWire” screen, enter: User ID: [Your assigned ID] Password:
PHP Meetup - SEO 2/12/2009. Where to Focus? Ensuring the findability of content Ensuring content is well understood by search engines Maximizing the importance.
SEO Best Practices with Web Content Management Brent Arrington, Services Developer, Hannon Hill Morgan Griffith, Marketing Director, Hannon Hill 2009 Cascade.
Microsoft Office Excel 2013 Core Microsoft Office Excel 2013 Core Courseware # 3253 Lesson 8: Macros, Importing and Exporting Data.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 1 Getting Started With Dreamweaver. Explore the Dreamweaver Workspace The Dreamweaver workspace is where you can find all the tools to create.
Overview of New Behind the Blackboard for Blackboard Customers APRIL 2012 TM.
ARCHIBUS Log On Instructions. Log Into ARCHIBUS Web Central Log In Screen 1.Open your Internet browser. 2.Enter the URL to view the ARCHIBUS Login Page.
Introduction to Object-oriented Programming CSIS 3701: Advanced Object Oriented Programming.
GOODWILL OF NORTHWEST NORTH CAROLINA, INC. EMPLOYEE TRAINING DATABASE PROTOTYPE.
Moving from Web-based collaboration to the mobile arena - Mobile, Task-Oriented Solutions Nimrod Geva Product Group Manager, KWizCom
WEB FORM DESIGN. Creating forms for a web page For your web project you have to design a form for inclusion on your web site (the form information should.
Classroom User Training June 29, 2005 Presented by:
ExtWebDriver Open Source Project Daniel Koo Latha Nagaraj Bryan Robbins 04/23/2014.
System for Administration, Training, and Educational Resources for NASA SATERN Overview for Learners May 2006.
Content Strategy.
E-Commerce: Introduction to Web Development 1 Dr. Lawrence West, Management Dept., University of Central Florida Topics What is a Web.
Lead Management Tool Partner User Guide March 15, 2013
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Wimba Presenters Guide North Dakota University System 2009.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Introduction In The Name Of Allah, The Beneficent, The Merciful.
Week 11 Creating Framed Layouts Objectives Understand the benefits and drawbacks of frames Understand and use frame syntax Customize frame characteristics.

Chapter 8 HTML Frames. 2 Principles of Web Design Chapter 8 Objectives Understand the benefits and drawbacks of frames Understand and use frames syntax.
About These Slides This slide set is designed to be used with the OMA sample application It is recommended you follow the steps outlined in the “Preparing.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Registration Solutions for your Event Management.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Module 9 User Profiles and Social Networking. Module Overview Configuring User Profiles Implementing SharePoint 2010 Social Networking Features.
WEB FORM DESIGN. Creating forms for a web page For your web project you have to design a form for inclusion on your web site (the form information should.
Optimizing today's websites using tomorrow's technologies.
Test Automation For Web-Based Applications Portnov Computer School 1 Selenium HP Web Test Tool Training.
Headings are defined with the to tags. defines the largest heading. defines the smallest heading. Note: Browsers automatically add an empty line before.
2004/051 >> Supply Chain Solutions That Deliver Users.
Eyeblaster Rich Media Basics. Global Digital Marketing Solutions Superior Technology & Expert Service Spanning 15 Countries  Digital ad serving and campaign.
XP New Perspectives on Microsoft Windows XP Tutorial 1 1 Microsoft Windows XP Creating a Web Site Tutorial 1.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
1 DATA-DRIVEN SOLUTIONS. 2 KEYWORD-LEVEL SEARCH RETARGETING TARGET USERS BASED ON THEIR RECENT SEARCH HISTORY AND SEARCH QUERIES. A user performs a search.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Search Engine Optimization (SEO) Presentation By Celina Jonesi Small Business Seo – KG Tech.
The Palantir Platform… …Changes in 2.3
Tagging And Measurement
Objectives Create a folder in Google Drive.
In this session, you will learn to:
OneSource Account Intelligence
Stable and reliable Web Automation
A Day In The Life of Extended CRM
Materials Engineering Product Data Management (ePDM)
9A0-411 Exam PDF | 9A0-411 Questions Answers | Dumps4download.us
Rapid fire performance testing of 250 websites
Visual Studio 2005 “Personalized productivity”
Utilizing the Capabilities of Microsoft Azure, Skipper Offers a Results-Based Platform That Helps Digital Advertisers with the Marketing of Their Mobile.
Trust and Culture on the Web
Using JDeveloper.
Introduction to ASP.NET Parts 1 & 2
Presentation transcript:

Selenium – Beyond the Page Object Pattern By: Sam Woods - Webtrends

Who Am I? Senior SDET at Webtrends for over a year. Heading up automation efforts including infrastructure, frameworks, processes, continuous integration, logging and reporting, etc. QA/SDET at Microsoft for 13 years. Evolved from manual testing and test planning to automation and finally development of automation infrastructure for the Windows Live organization. Primary developer of a web UI automation framework for 5+ years that was used by all of Windows Live and throughout the company.

Who is Webtrends? Webtrends powers digital marketing success. Webtrends is at the forefront of real-time digital marketing relevance and customer experience management through unified customer intelligence. Our industry-leading analytics across mobile, social and web enables marketers to optimize campaigns, maximize customer lifetime value and deliver highly relevant digital brand experiences in real time. Webtrends dramatically improves digital marketing results for more than 3,500 global brands including: The New York Times, Microsoft, BMW, RIM, China Telecom, China Mobile, CCTV, Tencent QQ, Hitachi, The Associated Press, HSBC, Barclays, Vivo Cellular and Petrobras.

How Does Webtrends Use Selenium? Selenium is currently used to test 2 distinct products. Analytics – reporting web site with a number of different report types for different content types (web, mobile, social, etc). Segments – web application used to create user “segments” and perform queries based on those segments and attributes. This is truly a “web app”. It is a single dynamic page with thousands of elements and a “canvas” to create visual representations of data that heavily relies on drag and drop.

History of the Page Object Pattern Created a base class called “PageObject” to programmatically enforce some best practices I had been using in my own automation. Also documented some rules and processes to follow when creating UI automation. Presented the concept to a number of audiences including to over 300 Microsoft Employees at an Engineering Excellence and Trustworthy Computing Forum. After leaving Microsoft, found that the Selenium community had begun standardizing on a “Page Object Pattern” that was strikingly similar. While at Microsoft I became a big advocate of shifting the mindset from “test scripts” to using object oriented programming techniques to decrease the amount of time it took to create and maintain automation.

The Evolution of (my) UI Automation Test Scripts > Remove Sleeps > Add Logging and Comments > Move retries and logging to abstraction > Move common startup code to xUnit startup class > Move elements to Page classes > Create logical helper functions in the page classes > Create common data classes to drive tests

DEMO TIME!

UI Automation Rules Never EVER sleep. Test cases should only access page class members, Page Class should only access abstraction layer, abstraction layer should only access selenium. Identify elements by ID if possible. Avoid identifying elements by text. Avoid identifying elements by xpath (or other means) that include parent or ancestor elements. Unless including a parent or ancestor can speed up searching for the element. Validation functions should return bool and the test case should assert.

Page Object Pattern (POP) VS My Solution

Exists in POP and not in my Solution Methods return other PageObjects. I don’t like this since depending on the data I enter into a form I may be taken to any number of pages including staying on the same page. Different results for the same action are modeled as different methods. I prefer a single method that I can execute and then call a validation method depending on the data I passed into the helper. PageFactory This is unnecessary since my abstraction uses lazy initialization for all elements.

Exists in my Solution and not in POP Static class containing all pages and helper functions that can span multiple pages. Base page class with Navigate function and ValidateLocation function

Abstraction Layer Goodness

Lazy Initialization Create an instance of an element object but doesn’t search for the element on the page until first use (execute a method or access a property) No need for PageFactory. No need using POP to create a new function for one simple action such as a click to a single element. Takes care of ensuring an element exists and is visible upon initialization. Mostly avoids StaleElementException.

Strongly Typed Element Objects Rather than a single IWebElement class, there is a Button, Link, Textbox, etc class. Finds elements faster (based on tag name) Avoids conflicts if multiple elements with different tag names match the element identifier. Able to trust intellisense since only methods/properties available for the specific element type show up. Easy to tell from the code what type of element you’re working with.

Get(related) functions GetParent, GetChild, GetChildren, GetDescendant, GetDescendants. Simplifies getting related elements Want to add GetSibling, GetSiblings, GetAncestor Speeds up finding elements on large pages if you set an AncestorElement as a property of any element. One caveat, this can only be executed after already navigating to the page containing the elements, no lazy initialization (can’t call it in your page object constructor)

Automatic Polling Searches to ensure an element exists and is visible before performing each action. MaxRetries and WaitBetweenRetries can be set globally or for a specific element, or use the defaults. Avoids most timing related issues due to pages not finished loading. Mostly makes logic to wait until a page is displayed unnecessary.

Miscellaneous Goodness Built in logging Built in creation of “ElementIdentifier” for logging. Find elements by any attribute or combination of attributes with exact match or partial match. DragAndDrop functions (using Actions class). Get innertext that is not visible (Selenium “feature”). Automatically switch to most recently opened window (handle links with “target” defined). Easily define iframe name or index to look for element in, or search in all iframes recursively. Click with offset

What’s Next? Releasing abstraction layer as an open source project to the community.

Questions?

Info/Resources http://sqa.stackexchange.com I participate here and there are a number of other people who can answer Selenium questions as well. E-mail: samwoo111@hotmail.com

Jobs at Webtrends http://jobvite.com/m?3lH1mfw9