Coded UI Test Automation Framework Tutorial

A typical software automation Testing requires automation tool like Selenium and QTP. Coded UI is similar to these tools and can be particularly useful for functional tests.

Coded UI Test ( CUIT) uses Visual Studio IDE to write scripts, as the recording can be done using Visual Studio.

In this tutorial, you will learn-

What is Coded UI Test (CUIT)?

CUIT are automated tests that drive your application through its user interface (UI). Hence, the name coded UI tests (CUITs). These tests involve functional testing of the UI controls. It checks the functionality of the whole application including the user interface.

Coded UI Test (CUIT)

Coded UI Test Features

Coded UI features include

Coded UI Test (CUIT) Supported Technologies

With coded UI, an application which has UI (User Interface) can be easily tested. The application can be either window based or web based.

Coded UI supports technologies like

Why use coded UI for test automation

The reason why coded UI for test automation is preferred

How to create coded UI tests(CUIT)

To create coded UI tests you can do it in following ways.

Contents of a Coded UI Test

When you create a coded UI test, the coded UI test builder creates a Map. This includes UI under test, test methods, parameters, assertions, etc. For each test, it also creates a class file.

File Content Editable
UIMap.Designer.cs Declaration section UIMap Class Methods Properties No
UIMap.cs UIMap class (partial) Yes
CodedUITest1.cs CodeUITest1 class Methods Properties Yes
UIMap.uitest The XML map of the UI for the test. It is edited only through UI Map editor No
  1. UIMap.Designer.cs : The designer contains the code view of the UIMap. It is generated when a tester records some UI interaction or when some objects are added manually to the UIMap.
  2. UIMap.cs: Any modification or customization done to the UIMap is stored in this file. Initially, this file will be blank and can be populated later on. If modifications are directly madeto the UIMap.designer.cs file, make sure it is not recorded otherwise all changes will be lost.

How to perform coded UI test

Coded UI has two different ways to conduct a test for your application.

  1. Coded UI Record and Playback or
  2. Coded UI Hand coding

You have to follow the following step to perform coded UI test,

  1. Create a coded UI test project
  2. Add a coded UI test file
  3. Record a sequence of actions
  4. Verify the values in UI fields such as text boxes
  5. View the generated test code
  6. Add more actions and assertions
  7. Edit the details of the test activities and the assertions
  8. Run the test

 

Best practices for Coded UI Test (CUIT)

Here are some best practices for a coded UI test,

Comparison of coded UI test Vs. Selenium vs. QTP

Below is the comparison table of coded UI test with other automation tools.

Coded UI Test (CUIT)

Summary:

 

YOU MIGHT LIKE: