Wednesday, July 13, 2011

CodedUI Automation tool

Coded UI is an UI test automation tool provided in Visual Studio 2010. Below are the features:
v   Record and Playback support
v   Generated code can be customized
v   Data parameterization (Data driven approach)
v   Assertions (similar to checkpoints in QTP)
v   Object synchronization (‘Wait’ statements)
v   Execute or run the automated tests
v   No built-in mechanism for handling events like unexpected dialogs
After recording a scenario, the following files will be added to the CodedUI project:

File
Description
Editable ?
CodedUITest1.cs
The default name for the file is CodedUITest1.cs. This is the file in which all the Test Methods are added
Yes
UIMap.uitest
An XML file has all the information about the recording including actions, objects and data.
NO (In future, MS may have editor for this file)
UIMap.Designer.cs
This file contains the code generated by the tool based on the recording in UIMap.uitest file (a.k.a. code behind file).
NO. Any edits to this will be lost
UIMap.cs
The main class generated by the tool is UIMap. This is partial class and is split into ‘UIMap.Designer.cs’  and ‘UIMap.cs’. While UIMap.Designer.cs contains code generated by the tool and should not be edited, the UIMap.cs file is the place where you would place all your customization
YES


The following assemblies are added as reference to the CodedUI project: 
v   Microsoft.VisualStudio.TestTools.UITesting (ApplicationUnderTest, BrowserWindow, Keyboard, Mouse, PlayBack, ControlType, UITestControl, etc.)
v   Microsoft.VisualStudio.TestTools.UnitTesting (Assert, StringAssert, Collection Assert)
v   Scenario to record: Browse google, search for a company and    ensure that company name and it’s URL is present in the first link
v   Microsoft.VisualStudio.TestTools.UITest.Common
v   Microsoft.VisualStudio.TestTools.UITest.Extension