Canarys | IT Services


Coded UI automation for web applications using Record and Playback approach.


First, What is Coded UI?

Coded UI (also called CUIT) is an automation testing tool provided by Microsoft technologies which helps in creating automated tests. The Coded UI tests help us verify the whole application such as User Interface and their functioning properties. Coded UI tests are more helpful when there are validations and logical user interface. Languages supported by Coded UI automation tool are: C#.NET and VB.NET.

Following are the three ways how one can create Coded UI tests:

  1. Record and Playback (Test builder)
  2. Hand coding / User coding
  3. Manual testing via MTM (Microsoft Test manager) tool

Now, let us start Coded UI automation from scratch and create tests using Record and Playback (through Test builder) approach.

Create a new project to begin with Visual Studio CUIT.

Following are the steps to create CUIT test project.

1. Open Visual Studio è File è New è Project.


2. Post successful creation of the project, code generator window will be displayed as shown below.


There are two options available in generating a code.

a. Record actions, edit UI map or add assertions: This option is selected by default, if this option is chosen a “UIMap – Coded UI Test Builder” will open for recording the actions and verifying results. Assertions can also be added using this record tool bar.

b. Use an existing action recording: When this option is chosen, the actions associated with test cases are performed to generate the code.

Let us select first option to record and verify results.

3. UIMap – Coded UI Test builder generally called recorder tool will be displayed as like below.


Choose recording icon and start recording the actions to test in application. We can also Pause/Resume the recording actions.

Show/Edit your actions by clicking on show recorded actions icon. We can also delete recorded actions which are unwanted.

Assertions are benchmarks, we can add assertions to UI controls in an application.

Convert the recorded actions into code form by clicking on generate code icon. Provide name and description (optional) for coded UI test method.

The generated code method will be displayed in Visual studio editor under CodedUITestMethod1().


This completes the recording section. Let us now look into how to Playback/Execute recorded methods in Coded UI.

1. There are two types to execute/playback the recorded methods.

  1. Click on BUILD from main navigational menu. Then select Build Solution from the BUILD dropdown list.



  1. Place the cursor point on recorded method, right click and select Run Tests from the options.



2. Go to TEST from main navigational menu, select Windows from Test drop down list and then select Test Explorer to find results of test execution.


Test Explorer screen will be displayed as below and a separate tab will be added to Visual Studio.



This ends the Record and Playback approach for web applications using Coded UI tests.


Want to know more on how to perform functional testing via handcode scripting in Visual studio?

Then subscribe to our blogs and keep yourself updated…


Happy Testing


Leave a Reply

Your email address will not be published. Required fields are marked *

Reach Us

With Canarys,
Let’s Plan. Grow. Strive. Succeed.