KEMBAR78
Functional UI Testing | PPTX
SKILLWISE-FUNCTIONAL
UI TESTING
Functional UI Testing
Testing at User’s Level
Introducing Functional UI Testing
• What is functional UI Testing?
– Testing things at the user interface level
– Automated UI interaction
– Verifying system functionality at highest level
• What’s it good for?
– Testing complete vertical slice
– Testing UI is wired-up correctly to rest of system
– Testing UI centric concerns
• What’s it not for?
– Design / cosmetics
– Detailed testing of entire system
Choosing a UI Automation Tool
• Record / Playback
– Tool records interaction with system and creates a test
– Doesn’t require programming skills
– Auto fake out external systems
– Tests sit in a separate repository
– Higher maintenance costs
• Coded
– Code driven approach
– Requires “automation test specialists” / programmers
– Access to full power of language / OS
– Lower long-term maintenance costs
– Easier to integrate with CI
Introducing WatiN Web Application
Testing Framework
• Web Application Testing for .Net languages
• Automate Internet Explorer
WatiN Fundamentals
• The IE class
– Encapsulates Internet Explorer
– Navigate to URL
– Locate HTML and interact with page elements
using (var browser = new IE(“http://www.google.com))
{
// test code here
}
WatiN Fundamentals
• Navigation to other pages
browser.GoTo(“http://www.bing.com”);
Browser.GoTo(“http://www.google.com”);
browser.Back();
browser.Forward();
WatiN Fundamentals
• Finding HTML elements by ID
– Browser.<type of element>(Find.ById(“<html id>”));
TextField applicantName = browser.TextField(Find.ById(“Name”));
Link helpHyperlink = browser.Link(Find.ById(“HelpLink”));
Button applyButton = browser.Button(Find.ById(“ApplyNow”));
Para nameParagraph = browser.Para(Find.ById(“Name”));
WatiN Fundamentals
• Interacting with elements
TextField applicantname = browser.TextField(Find.ById(“Name”));
applicantName.TypeText(“Jason Roberts”);
Link helpHyperlink = browser.Link(Find.ById(“HelpLink”));
helpHyperlink.Click();
SelectList title = browser.SelectList(Find.ById(“Title”));
title.Select(“Prof”);
titleSelectByValue(“4”);
Button applyButton = browser.Button(Find.ById(“ApplyNow”));
applyButton.Click();
WatiN Fundamentals
• Finding elements other than by ID
Div errorContainer = browser.Div(Find.ByClass(“error”));
SelectList title = browser.SelectList(Find.ByName(“Title”));
Label ageLabel = browser.Label(Find.ByFor(“Age”));
TextField applicantAge =
browser.TextField(Find.ByLabelText(“Age In Years”));
TextField applicantAge2 = browser.TextField(Find.By(“id”,
“Age”));
The Physical Object Model (POM) Style
• Model the “physical elements on each page
• Expose each control on the page as property
• Expose each user action as a method
• Creates an abstraction layer to insulate test
code
Logical Functional Model (LFM) Style
• Models user interactions at a higher level
• Expose each logical functional action as a method
• Can sit on top of POM
• Valuable when same logical functional action
used in many tests
Advanced Considerations
• Categorizing Tests
• Reusing IE browser instance
• Navigation framework
• Test data management / creation
• Add a BDD-style layer such as SpecFlow
Functional UI Testing

Functional UI Testing

  • 1.
  • 2.
  • 3.
    Introducing Functional UITesting • What is functional UI Testing? – Testing things at the user interface level – Automated UI interaction – Verifying system functionality at highest level • What’s it good for? – Testing complete vertical slice – Testing UI is wired-up correctly to rest of system – Testing UI centric concerns • What’s it not for? – Design / cosmetics – Detailed testing of entire system
  • 4.
    Choosing a UIAutomation Tool • Record / Playback – Tool records interaction with system and creates a test – Doesn’t require programming skills – Auto fake out external systems – Tests sit in a separate repository – Higher maintenance costs • Coded – Code driven approach – Requires “automation test specialists” / programmers – Access to full power of language / OS – Lower long-term maintenance costs – Easier to integrate with CI
  • 5.
    Introducing WatiN WebApplication Testing Framework • Web Application Testing for .Net languages • Automate Internet Explorer
  • 6.
    WatiN Fundamentals • TheIE class – Encapsulates Internet Explorer – Navigate to URL – Locate HTML and interact with page elements using (var browser = new IE(“http://www.google.com)) { // test code here }
  • 7.
    WatiN Fundamentals • Navigationto other pages browser.GoTo(“http://www.bing.com”); Browser.GoTo(“http://www.google.com”); browser.Back(); browser.Forward();
  • 8.
    WatiN Fundamentals • FindingHTML elements by ID – Browser.<type of element>(Find.ById(“<html id>”)); TextField applicantName = browser.TextField(Find.ById(“Name”)); Link helpHyperlink = browser.Link(Find.ById(“HelpLink”)); Button applyButton = browser.Button(Find.ById(“ApplyNow”)); Para nameParagraph = browser.Para(Find.ById(“Name”));
  • 9.
    WatiN Fundamentals • Interactingwith elements TextField applicantname = browser.TextField(Find.ById(“Name”)); applicantName.TypeText(“Jason Roberts”); Link helpHyperlink = browser.Link(Find.ById(“HelpLink”)); helpHyperlink.Click(); SelectList title = browser.SelectList(Find.ById(“Title”)); title.Select(“Prof”); titleSelectByValue(“4”); Button applyButton = browser.Button(Find.ById(“ApplyNow”)); applyButton.Click();
  • 10.
    WatiN Fundamentals • Findingelements other than by ID Div errorContainer = browser.Div(Find.ByClass(“error”)); SelectList title = browser.SelectList(Find.ByName(“Title”)); Label ageLabel = browser.Label(Find.ByFor(“Age”)); TextField applicantAge = browser.TextField(Find.ByLabelText(“Age In Years”)); TextField applicantAge2 = browser.TextField(Find.By(“id”, “Age”));
  • 11.
    The Physical ObjectModel (POM) Style • Model the “physical elements on each page • Expose each control on the page as property • Expose each user action as a method • Creates an abstraction layer to insulate test code
  • 12.
    Logical Functional Model(LFM) Style • Models user interactions at a higher level • Expose each logical functional action as a method • Can sit on top of POM • Valuable when same logical functional action used in many tests
  • 13.
    Advanced Considerations • CategorizingTests • Reusing IE browser instance • Navigation framework • Test data management / creation • Add a BDD-style layer such as SpecFlow