Software automation using Visual        Studio-CodedUI
What is CodedUI• Integrated Testing tool for UI Automation which comeswith Visual Studio (Premium & Ultimate)• Supports bo...
Support Matrix
Cross browser support• Windows 8 X86 Client/Windows 8 X64/Win7 X64/Win7    X86/Win2k8 R2 SP1•   IE version - IE9/ classic ...
Working with CodedUI• 2 ways we can work with CodedUI  – Using built-in Test builder     • You simply perform the test man...
Why Hand-Coding• Generated code has   – Duplicate scripts   – Repeated hardcode       • Cost lot of time to change code   ...
Page objects• Within your web apps UI there are areas that your tests  interact with.• A Page Object simply models these a...
Interacting  Objects
Microsoft.VisualStudio.TestTools.UITesting.HtmlControls–   HtmlSpan–   HtmlDiv–   HtmlInputButton–   HtmlHyperlink–   Html...
Identifying objects• Using asserting feature of CodedUI
UI Technologies for searching controls.• Internet Explorer Testing: Uses MSHTML, DOM to retrieve  properties and identify ...
CUITe• CUITe (Coded UI Test enhanced) Framework• Is a thin layer developed on top of Coded UI Test engine  which helps red...
Upcoming SlideShare
Loading in …5
×

Coded UI: Hand Coding based on Page Object Model

10,408
-1

Published on

Coded UI is a User Interface (UI) Test Automation Tool that comes with Microsoft Visual Studio which can be used to automate our manual, repetitive and regression tests thereby increase productivity of Testing teams.

1 Comment
3 Likes
Statistics
Notes
  • I'm building hand-code Coded UI Tests, which I write about in my blog.

    Some posts:

    -- http://burdettelamar.wordpress.com/2014/03/21/keep-your-page-objects-dry/
    -- http://burdettelamar.wordpress.com/2014/04/19/clean-and-dry-verifiers/
    -- http://burdettelamar.wordpress.com/2014/04/12/location-location-location/
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
10,408
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
199
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Coded UI: Hand Coding based on Page Object Model

  1. 1. Software automation using Visual Studio-CodedUI
  2. 2. What is CodedUI• Integrated Testing tool for UI Automation which comeswith Visual Studio (Premium & Ultimate)• Supports both Web and Win application User Interface(UI) Test automation
  3. 3. Support Matrix
  4. 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. 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. 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. 7. Page objects• Within your web apps 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”
  8. 8. Interacting Objects
  9. 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. 10. Identifying objects• Using asserting feature of CodedUI
  11. 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. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×