Coded UI

Coded UI is a UI testing framework.

Prerequisites for Coded UI :

Visual Studio 2012 or Visual Studio 2010 Premium or Ultimate. Incase you have not installed full versions of the Visual Studio 2010, install feature pack 2 for Visual Studio from here.

What can you do with Coded UI ?


Demo : Testing Bing using Coded UI.

Open Visual Studio 2012. After installation you will see Coded UI Test project template in Test.


Select the first option to record.

The panel below has 4 options :

1) Record actions 2) Show Recorded Steps 3) Add Assertions 4) Generate Code .


Open browser and type and click record.

Steps to record :
1) Type Visual Studio 2010 in the search box.
2) Click Search.
3) Click on back button of browser. Run the tests.
NOTE: While running the tests , the state of UI has to be same as and when recorded, so that the running test can locate the search box and execute tests.Else tests might fail.

Below is the project structure.
CodedUITest1.cs – code for running tests.
UIMap.uitest – xml file which records actions on user interface.testprojectstructure

Making your UI Test Data Driven.
Open Excel and enter data for your search list.
Save it as Data.csv. Add Data.csv to your project. Set its properties. Set Build Action to Content and Copy to Output Directory to Copy Always.

Add the attribute above your test method to take input values from the Data.csv file .datasource

To take data from excel sheet , you will have to set the parameters as below.

“|DataDirectory|\\Data.csv”, “Data#csv”,
public void CodedUITestMethod1()
this.UIMap.TestBingParams.UIEnteryoursearchtermEditText = TestContext.DataRow[“SearchText”].ToString();

Run your tests. There you have data driven tests for Bing UI. Your search will be done for all the inputs.

Posted in Uncategorized. Leave a Comment »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s