Site Loader
Auckland, New Zealand
In this post, we will discuss some of the most basic concept before starting the hand coding in Coded UI Testing with Visual Studio. As a pre-requisite, please watch the video from the article Coded UI record and playback . In previous post, we discussed how each and every controls are identified and how visual studio searches for all these controls and the controls base classes.

Controls Hierarchy

All the controls based on their technology lets say Html, MSAA or UIA have base classes for example,
  • All Windows controls has base class of WinControl
  • All Html controls has base class of HtmlControl and
  • All WPF controls has base class of WpfControl
But, for all the controls, there is one more base class called UITestControl, which is available in Microsoft.VisualStudio.TestTools.UITesting namespace. As shown above, all the controls of specific technology has base class as UITestControl.

Reengineering UIMap.Designer.cs

In this post, we will just copy paste some of the auto-generated codes from UIMap.Designer.cs into a new class file and then we will try to create one more class called Caller.cs, which will call the execution to happen. Note that, for each and every controls, we will maintain their relationship between parent and child, so that the control can be identified without any problem. Please watch the complete video below Please leave your comments and thanks for watching the video and reading the article !!! Thanks, Karthik KK

Post Author: Karthik kk

5 Replies to “Hand Coding in Coded UI Testing – Part 1”

  1. Hi,
    Am trying to automate dax (2012) but frequently am getting the below error
    st method ax.CodedUITest1.CodedUITestMethod1 threw exception:
    Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
    TechnologyName: ‘MSAA’
    ControlType: ‘Window’
    Name: ‘‪Microsoft Dynamics AX‬ – ‎‪Avanade France‬ [‎‪TLSPILDEVDYN‬‪: ‎‪Session ID‬ – ‎‪4]‎ – ‎ [‎‪1‬ – ‎‪afms‬]‎’
    ClassName: ‘WindowsForms10.Window’
    Instance: ’17’
    —> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

    Dunno where am i going wron, actually am a manual tester new to this visula studio autoamtion…but succesffully did the my project web application autoamtion but unable to automate DAX…..may be am missing any basic logics in autoamting(handed coded ui not record and play) the DAX…please can anyone help me

    1. I think the control is not found by your code.

      Try using some other identification property.

      Karthik KK

  2. I am writing a coded ui tests, and in that I need to call an already stored Installation ID. I have tried many ways but my script fails in that particular part.
    The code which I have written for calling the Installation ID is:
    uiInsId.SetProperty(WinEdit.PropertyNames.Text, GlobalVariables.TxtInstallId.ToString());

    Where -Txt.InstallId is a global variable used for Installtion ID

    Please help me I am stuck here

    1. Are you trying to set value to uiInsId ?

      If so, you can do via


      If you cannot set a value to the Editbox, then it should be problem with the global variable which has got the value, check if the variable has the value you are looking for

      Karthik KK

  3. Hi There, I am in the same kind of situation as you. I am trying to find a button control of DAX UI through Codedui but I am constantly getting below error. Can you please help me to resolve it, i have spent lot’s of time on it. Even though i have used all possible search properties to find the control

    Test Name: CodedUITestMethod1 (Data Row 0)
    Test Outcome: Failed
    Result Message:
    Test method New_Owner.CodedUITest1_Inquiry.CodedUITestMethod1 threw exception:
    Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnBlockedControlException: Another control is blocking the control. Please make the blocked control visible and retry the action. Additional Details:
    TechnologyName: ‘Web’
    ControlType: ‘Button’
    TagName: ‘INPUT’
    Id: ‘ctl00_body_btnCreateOwner’
    Name: ‘ctl00$body$btnCreateOwner’
    —> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0xF004F003
    Result StandardOutput: Debug Trace:
    02-06-2018:10:06 start

Leave a Reply

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