Coded UI Testing

What is Code UI Testing, or more to the point what is the difference between Unit Tests and Coded UI Tests?

Unit Tests

  • Tests classes and methods at the API level
  • If it test a UI, it’s testing an abstraction (not quite testing the UI), UI testing has been hard
  • Testing code as you built it
  • We are testing in isolation

Coded UI Tests

  • UI testing
  • Testing a running application
  • Simulates a user’s keyboard and mouse activities
  • Test the application that’s pretty much done
  • Integration testing

Looking at the layers in your application

  • User Interface
  • Presentation (MVC/MVVM)
  • Domain Model / Service Layer
  • Repository / Data Access
  • The Relational Database (Tables, Views, Stored Procedures etc)

The Coded UI tests are only interested in the User Interface, and Unit tests deal with everything else.


Unit tests test your API’s

Coded UI Tests test your running User Interfaces

Support for Code UI

Operation Systems

  • Windows 7
  • Windows 8
  • WIndows Server 2008 R2
  • Windows Server 8

Web Applications in Internet Explorer 8, 9 and 10

Windows application

  • Windows Form 2.0 and higher
  • WPF 3.5 and higher

Dynamics CRM web client

Partially Supported

  • Windows Win32
  • Dynamics (Ax) 2012
  • MFC
  • Citrix / Terminal Services
  • SharePoint
  • Power Builder

For a complete list go to:

No Support for Code UI


  • Internet Explorer 7
  • Internet Explorer 8
  • Chrome
  • Firefox
  • Opera
  • Safari


  • Silverlight
  • Flash

Office Cleint Applications



Structure of a Coded UI Test

The Test Fixture Class

  • [CodedUI] attribute
  • Editable like any other class


  • Auto-generated XML-based “map” of your UI
  • Not editable


  • Supporting information for the test
  • Auto-generated by the recorder
  • Partial class


  • partial class
  • Customizations and extensions to the UIMap.designer.cs


Create Coded UI Tests using the recorder

Create Coded UI Tests using MTM Action Recordings

Editing and extending Coded UI tests