SlideShare a Scribd company logo
Software automation using Visual
        Studio-CodedUI
What is CodedUI
• Integrated Testing tool for UI Automation which comes
with Visual Studio (Premium & Ultimate)

• Supports both Web and Win application User Interface
(UI) Test automation
Support Matrix
Cross browser support
• Windows 8 X86 Client/Windows 8 X64/Win7 X64/Win7
    X86/Win2k8 R2 SP1
•   IE version - IE9/ classic IE10
•   Firefox version - 15+
•   Chrome version - 21+
•   Visual Studio Ultimate/Premium - VS 2012 RTM + VS 2012
    Update 1
•   Selenium NET Bindings and the Selenium ChromeDriver
    on Visual Studio Gallery.
Working with CodedUI
• 2 ways we can work with CodedUI
  – Using built-in Test builder
     • You simply perform the test manually while the
       CUIT Test Builder runs in the background
     • The code is generated automatically
• Hand-code
   – Based on “Page Object Model”
     • Create an Object repository
     • Write code manually for each object to achieve
       the task
Why Hand-Coding
• Generated code has
   – Duplicate scripts
   – Repeated hardcode
       • Cost lot of time to change code
   – Unmanaged UI control
       • One control may be recorded by many times
• Hand code
   – More control over the code
   – Increase maintainability
   – Increase readability
   – Improve sustainability (reusable objects, data driven,
     constant values in .settings file etc)
Page objects
• Within your web app's UI there are areas that your tests
  interact with.
• A Page Object simply models these as objects within the test
  code.
       • Reduce duplicated code and if changed %only be
         applied in one place.

       “The Page Object pattern represents the screens of your
         web app as a series of objects”
Interacting
  Objects
Microsoft.VisualStudio.TestTools.UITesting.HtmlControls



–   HtmlSpan
–   HtmlDiv
–   HtmlInputButton
–   HtmlHyperlink
–   HtmlEdit
     public static HtmlEdit txtStepbox(BrowserWindow browser)

     {
     HtmlEdit stepbox = new HtmlEdit(browser);
     stepbox.SearchProperties.Add(HtmlEdit.PropertyNames.Name, "_ctl0:_ctl0:orderLines:_ctl3");
     return stepbox;
       }

– HtmlCustom
Identifying objects
• Using asserting feature of CodedUI
UI Technologies for searching controls.
• Internet Explorer Testing: Uses MSHTML, DOM to retrieve
  properties and identify controls hosted within the Internet
  Explorer.

• UIA: UI Automation is the new accessibility framework for
  Microsoft Windows, available on all operating systems that
  support Windows Presentation Foundation (WPF).

• MSAA: This is picked for Winforms Controls, Win32 controls,
  MFC applications. All the controls that are not picked up by
  the above two are picked by MSAA.
CUITe
• CUITe (Coded UI Test enhanced) Framework
• Is a thin layer developed on top of Coded UI Test engine
  which helps reduce code, increases readability &
  maintainability.

Feature List
   – Simple to setup and use, just install and refer “CUITe.dll” in your Test
     project
   – Object Repository: Keeps UI Object definitions separate from automation
     code (no more UIMaps)
   – Reduces code to <10%: Readable, maintainable, sustainable UI
     automation code
   – Treat table as Table (logical way of handling content inside a table)
   – Web Automation: JavaScript execution support
   – Supports Silverlight and whatever (Html & Silverlight at this point) Coded
     UI Test supports underneath

More Related Content

PPTX
Coded ui - lesson 4 - coded ui test
PPTX
Coded ui - lesson 6 - manual coding
PPTX
Coded UI - Test automation Practices from the Field
PPTX
Advanced Coded UI Testing
PPTX
Coded ui test
PPTX
Coded ui - lesson 2 - coded ui test builder
PPTX
Coded ui - lesson 1 - overview
PPTX
Coded ui - lesson 3 - case study - calculator
Coded ui - lesson 4 - coded ui test
Coded ui - lesson 6 - manual coding
Coded UI - Test automation Practices from the Field
Advanced Coded UI Testing
Coded ui test
Coded ui - lesson 2 - coded ui test builder
Coded ui - lesson 1 - overview
Coded ui - lesson 3 - case study - calculator

What's hot (20)

PPTX
Coded ui - lesson 9 - test windows
PPTX
Coded ui in a nutshell
PPTX
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
PPTX
Testing the User Interface - Coded UI Tests with Visual Studio 2010
PPTX
Unit testing with visual studio 2012
PPTX
Remote Test Execution using TFS 2015 (RC2 and beyond)
PPTX
Coded ui - lesson 5 - ui map
PDF
Technical meeting automated testing with vs2010
PPT
Active x
PPTX
Automation Testing with TestComplete
PPTX
DaKiRY_BAQ2016_QADay_Marta Firlej "Microsoft Test Manager tool – how can we u...
PDF
Visual Basic IDE Introduction
PPTX
Visual studio Team system 2012
PPTX
Lab Management with TFS 2010
PDF
Steps how to create active x using visual studio 2008
DOC
Getting started with test complete 7
PPTX
Intro to Microsoft Test Manager
PPTX
Treeview listview
PPT
QTP&UFT Automation Framework
PPT
Qtp 9.2 tutorials
Coded ui - lesson 9 - test windows
Coded ui in a nutshell
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Testing the User Interface - Coded UI Tests with Visual Studio 2010
Unit testing with visual studio 2012
Remote Test Execution using TFS 2015 (RC2 and beyond)
Coded ui - lesson 5 - ui map
Technical meeting automated testing with vs2010
Active x
Automation Testing with TestComplete
DaKiRY_BAQ2016_QADay_Marta Firlej "Microsoft Test Manager tool – how can we u...
Visual Basic IDE Introduction
Visual studio Team system 2012
Lab Management with TFS 2010
Steps how to create active x using visual studio 2008
Getting started with test complete 7
Intro to Microsoft Test Manager
Treeview listview
QTP&UFT Automation Framework
Qtp 9.2 tutorials
Ad

Viewers also liked (10)

PDF
Visual Automation Framework via Screenshot Comparison
PPTX
Advanced Visual Test Automation With Selenium
PPTX
Selenium Based Visual Test Automation
PPTX
Visual Studio Automation
PDF
TestingAR IX - Retorno de Inversión - POM TestingAr
PPTX
Coded UI
PPT
Станислав Косарев - Автоматизация тестирования десктопных приложений. Как и п...
PPT
UI testing frameworks and the Coded UI testing paradigm
PPT
PPT
Web Service Presentation
Visual Automation Framework via Screenshot Comparison
Advanced Visual Test Automation With Selenium
Selenium Based Visual Test Automation
Visual Studio Automation
TestingAR IX - Retorno de Inversión - POM TestingAr
Coded UI
Станислав Косарев - Автоматизация тестирования десктопных приложений. Как и п...
UI testing frameworks and the Coded UI testing paradigm
Web Service Presentation
Ad

Similar to Coded UI: Hand Coding based on Page Object Model (20)

PPTX
Getting Started with Coded UI Testing: Building Your First Automated Test
PPT
Test Automation Framework Designs
PDF
Getting Started With Coded UI testing: Building Your First Automated Test
PPT
Test Automation Framework Designs
PPTX
Automated UI testing done right (DDDSydney)
PPTX
Test Automation Techniques for Windows Applications
PPTX
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
PPTX
DeveloperDeveloperDeveloper! Sydney 2012
PPTX
Udvid din test portefølje med coded ui test og cloud load test
PPTX
Testing ASP.NET - Progressive.NET
PPTX
Automated UI Testing Done Right (QMSDNUG)
PPTX
Designing Self-maintaining UI Tests for Web Applications
PPTX
Coding Naked
PPTX
Getting Started with Visual Studio’s Coded UI Testing: Building Your First Au...
PDF
Acceptance Testing of Web UI
PPTX
Unit Testing in VS2012
PPTX
ALM@Work - Unit testing in Visual studio 2012
PDF
UI Testing: A Complete Guide With Techniques, Tools, & Best Practices
PDF
Automation Open Source tools
PPT
Designing a Test Automation Framework By Quontra solutions
Getting Started with Coded UI Testing: Building Your First Automated Test
Test Automation Framework Designs
Getting Started With Coded UI testing: Building Your First Automated Test
Test Automation Framework Designs
Automated UI testing done right (DDDSydney)
Test Automation Techniques for Windows Applications
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
DeveloperDeveloperDeveloper! Sydney 2012
Udvid din test portefølje med coded ui test og cloud load test
Testing ASP.NET - Progressive.NET
Automated UI Testing Done Right (QMSDNUG)
Designing Self-maintaining UI Tests for Web Applications
Coding Naked
Getting Started with Visual Studio’s Coded UI Testing: Building Your First Au...
Acceptance Testing of Web UI
Unit Testing in VS2012
ALM@Work - Unit testing in Visual studio 2012
UI Testing: A Complete Guide With Techniques, Tools, & Best Practices
Automation Open Source tools
Designing a Test Automation Framework By Quontra solutions

More from Tharinda Liyanage (8)

PPTX
Testing strategy for agile projects updated
PPTX
Qa and Testing
PPTX
"Introduction to JMeter" @ CPTM 3rd Session
PPTX
Useful JMeter functions for scripting
PPTX
Introduction to Performance Testing
PPTX
Formulating Agile Testing Strategy
PPTX
PerfTest in SOA
PPTX
Introduction to performance testing
Testing strategy for agile projects updated
Qa and Testing
"Introduction to JMeter" @ CPTM 3rd Session
Useful JMeter functions for scripting
Introduction to Performance Testing
Formulating Agile Testing Strategy
PerfTest in SOA
Introduction to performance testing

Coded UI: Hand Coding based on Page Object Model

  • 1. Software automation using Visual Studio-CodedUI
  • 2. What is CodedUI • Integrated Testing tool for UI Automation which comes with Visual Studio (Premium & Ultimate) • Supports both Web and Win application User Interface (UI) Test automation
  • 4. Cross browser support • Windows 8 X86 Client/Windows 8 X64/Win7 X64/Win7 X86/Win2k8 R2 SP1 • IE version - IE9/ classic IE10 • Firefox version - 15+ • Chrome version - 21+ • Visual Studio Ultimate/Premium - VS 2012 RTM + VS 2012 Update 1 • Selenium NET Bindings and the Selenium ChromeDriver on Visual Studio Gallery.
  • 5. Working with CodedUI • 2 ways we can work with CodedUI – Using built-in Test builder • You simply perform the test manually while the CUIT Test Builder runs in the background • The code is generated automatically • Hand-code – Based on “Page Object Model” • Create an Object repository • Write code manually for each object to achieve the task
  • 6. Why Hand-Coding • Generated code has – Duplicate scripts – Repeated hardcode • Cost lot of time to change code – Unmanaged UI control • One control may be recorded by many times • Hand code – More control over the code – Increase maintainability – Increase readability – Improve sustainability (reusable objects, data driven, constant values in .settings file etc)
  • 7. Page objects • Within your web app's UI there are areas that your tests interact with. • A Page Object simply models these as objects within the test code. • Reduce duplicated code and if changed %only be applied in one place. “The Page Object pattern represents the screens of your web app as a series of objects”
  • 9. Microsoft.VisualStudio.TestTools.UITesting.HtmlControls – HtmlSpan – HtmlDiv – HtmlInputButton – HtmlHyperlink – HtmlEdit public static HtmlEdit txtStepbox(BrowserWindow browser) { HtmlEdit stepbox = new HtmlEdit(browser); stepbox.SearchProperties.Add(HtmlEdit.PropertyNames.Name, "_ctl0:_ctl0:orderLines:_ctl3"); return stepbox; } – HtmlCustom
  • 10. Identifying objects • Using asserting feature of CodedUI
  • 11. UI Technologies for searching controls. • Internet Explorer Testing: Uses MSHTML, DOM to retrieve properties and identify controls hosted within the Internet Explorer. • UIA: UI Automation is the new accessibility framework for Microsoft Windows, available on all operating systems that support Windows Presentation Foundation (WPF). • MSAA: This is picked for Winforms Controls, Win32 controls, MFC applications. All the controls that are not picked up by the above two are picked by MSAA.
  • 12. CUITe • CUITe (Coded UI Test enhanced) Framework • Is a thin layer developed on top of Coded UI Test engine which helps reduce code, increases readability & maintainability. Feature List – Simple to setup and use, just install and refer “CUITe.dll” in your Test project – Object Repository: Keeps UI Object definitions separate from automation code (no more UIMaps) – Reduces code to <10%: Readable, maintainable, sustainable UI automation code – Treat table as Table (logical way of handling content inside a table) – Web Automation: JavaScript execution support – Supports Silverlight and whatever (Html & Silverlight at this point) Coded UI Test supports underneath