Coded UI: Hand Coding based on Page Object Model

  • 5,558 views
Uploaded 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 …

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.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • 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/
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
5,558
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
106
Comments
1
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Software automation using Visual Studio-CodedUI
  • 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. Support Matrix
  • 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 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. Interacting 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