Site Loader
Auckland, New Zealand
As we already discuss in previous post, Coded UI Test builder automatically generates couple of class files or otherwise called as UIMaps. UIMaps are more like Object Repository in QTP and Name mapping feature in Test Complete. One project can have more than one UIMaps, so that we can split and store objects in these UIMap to reduce confusion and clear distinction in project, but still, let’s see how Coded UI Test builder records and stores application objects in it.

Deep Dive in to UIMap.Designer.cs file

All the methods, classes and properties created with UIMap.Designer.cs file are automatically generated, hence any change made in UIMap.Designer.cs file will be deleted once new recording of code is done via Coded UI Test builder. As you can see in the below screenshot, the UIMap class file is decorated with GeneratedCode attribute

Recorded Method is the actual method which holds all the action which is performed in the Coded UI Test Builder as shown below

As you can see the above code, each and every control (button in this case) is first created as an instance with its type and then assigned with its search properties. We will talk more above search properties and filter properties later in this series of post, but for now just consider that each control is assigned with a search property and then using Mouse.Clickthese controls are performed click operations. Let’s, discuss the more detailed version of the same topic in video. Please leave your comments!!! Thanks, Karthik KK

Post Author: Karthik kk

17 Replies to “Understanding Coded UI Recorded Code from UIMap”

  1. Great video and video series! I’ve been spending hours researching CodedUI on the net. Finding these videos sooner would have saved me weeks of searching and watching videos. Thanks Karthik KK!!

    1. Thank you very much for watching all my videos and reading the articles.

      Glad you like it it Phil!!!

      Thanks,
      Karthik KK

      1. hi karthik, thank you very much for posting these videos and articles. So much helpful for me and saved my months of searching coded ui tutorials.

  2. Hi Kartik,

    I am unable to record using the Visual Studio Ulitmate Coded UI 2013 on calculator buttons like 1 or 2, and looked around searching for what I am missing, found that recording option is not anymore on Coded UI 2013. Could you let me know how you were able to record.

    Thanks
    Raj

        1. Windows 10 version of Calculator is not supported by Coded UI testing for now, you can try with earlier version of Windows (say 8.1/8/7) which should work fine.

          Hope this helps !!!

          Thanks,
          Karthik KK

      1. Hi Kartik,

        I have downloaded calculator plus (since I have Windows 10) and was able to record and play back.
        Now I am on 6th video (Data Driven Testing in Coded UI Test Record and Playback). My test is failing and after looking into my designer.cs found below under AssertAdd()
        WinEdit uIItemEdit = this.UICalculatorPlusWindow.UIItemWindow2.UIItemEdit;
        but you have in your video as below
        WinText uIItem112Text = this.UICalculatorWindow.UIItemWindow112.UIItem112Text;
        Now, question is why I am having “uIItemEdit” and you have “uIItem112Text”.
        Am I suppose to download any particular Calculator, if your answer yes. Which calculator is that and where do I find.

        public void AssertAdd()
        {
        #region Variable Declarations
        WinEdit uIItemEdit = this.UICalculatorPlusWindow.UIItemWindow2.UIItemEdit;
        #endregion

        // Verify that the ‘Text’ property of text box equals ’90. ‘
        Assert.AreEqual(this.AssertAddExpectedValues.UIItemEditText, uIItemEdit.Text, “Result should be 90, or else Calculation Fails”);
        }

        Thanks,
        Raj

        1. Its because the out-of-box calculator of windows 8 and the Calculator plus have different object ids.

          Hope it answers your question !!!

          Thanks,
          Karthik KK

  3. Hi Karthik,

    That is the Calculator (Calculator plus) I am using and got into issue.
    you have in your video as below
    WinText uIItem112Text = this.UICalculatorWindow.UIItemWindow112.UIItem112Text;
    Now, question is why I am having “uIItemEdit” and you have “uIItem112Text”.
    Am I suppose to download any particular Calculator, if your answer yes. Which calculator is that and where do I find.

    Thanks,
    Raj

  4. This is a great resource for Coded UI. My team is starting to build out automation on an extensive windows application. I will forward this to my team to view.

Leave a Reply to Raj Cancel reply

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