Site Loader
Auckland, New Zealand
As already discussed in previous post, Coded UI has two types of testing feature

Record and playback 

Coded UI Hand coding
Coded UI record and playback feature is much like the feature available in popular testing tools like QTP, Test Complete and SoapUI, where Coded UI records all the user actions via Coded UI Test Builder.

Coded UI Test Builder

Coded UI Test Builder is the recording option which is found in other testing tools like QTP and Test Complete as well. It will have a
  • Record Button – To start recording the test
  • Cross hair option – To get the identification property of the pointed object (like Object Spy)
  • Generate Script – This option will generate the script
  • Insert Assertion – This option will let us to insert assertion for a particular control
  • Show Recorded Steps – This option will show the complete recorded steps

All the recorded actions are stored in a separate class file called UIMap in the project.

So what is UIMAP?

UIMap is more like an Object Repository in QTP and Name Mapping in Test Complete were UIMap stores all the objects of Application Under Test (AUT) as a class file. The UIMap looks something like this

UIMap will have hierarchy of the controls identified, this will be helpful to locate each and every controls and their parent child relationship. We can also locate the element from UIMap to actual UI of AUT as shown below

Deep Dive into UIMap

UIMap actually has two classes as shown below

These two classes are auto-generated and modification to UIMap.Designer.cs file will revert back once you do a new recording using coded UI Test Builder. This you can see in the file instruction itself, but user has the leverage to change the UIMap.cs file and work with the objects and properties from UIMap.Designer.cs file.

Technically these two classes are partial class files and are pretty much dependent.

How to Execute the Code?

So how to finally execute the recorded code?

Option 1

Well, just go to your CodedUITest.cs class file which you have created and right click the test method and click Run Test option as shown below

Option 2

You can also run your test using Test Explorer, which can be found from Test à Window à Test Explorer

That’s all guys, this way we can perform record and playback using Coded UI testing in Visual Studio 2013. Please leave your comments and thanks for watching the video and reading the article !!! Thanks, Karthik KK

Post Author: Karthik kk

10 Replies to “Coded UI Record and Playback”

  1. The section “Deep Dive into UIMap” is mistaken about the structure of the UI Map. The section saying “UIMap actually has two classes as shown below. These two classes are auto-generated and modification to any of these class files will revert back once you do a new recording using coded UI Test Builder.“. This is wrong.

    The two files “UIMap.cs” and “UIMap.Designer.cs” combine to make one class. The file “UIMap.Designer.cs” will be regenerated after a new recording or after editing the “UIMap.uitest” file. The “UIMap.cs” file will not be regenerated, it is for the test developer’s code. This is a common pattern with Visual Studio’s tools. Two files combine to make a class, one is auto-generated and the other is for user-written additions to the class.

    1. Changes to the article done Adrain, and once again thank you for reading and suggesting your correction, this will help us all !!!

      Thanks,
      Karthik KK

    2. Hi Adrian/Karthick,
      I think if you do modification on UIMap.uitest file, it will accept the changes and both UIMap.uitest and UIMap.Designer.cs will have the updated code. i.e UIMap.Designer.cs will not be regenerated in this case. Could you please confirm?

  2. Hi Karthik,
    Can we generate the video recording file of automated suite ?
    Ex. If I am running one simple automated test suite in Coede UI.
    Now I want to record this suite at the automation run time & it will store it in a folder as a log.
    Can we do that with VSTS2013/Coded UI ?
    Please help me into this issue or suggest me any parallel way for it. Thanks !

Leave a Reply to Zakir Hussain Cancel reply

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