Site Loader
Auckland, New Zealand
We already discussed hand coding Coded UI Test using WinControls in previous posts, in this post, we will discuss about hand coding CUIT with UITestControls.
  • We already discussed about UITestControl, stating this class is the base class for all the technologies like WinControl, HtmlControl etc
  • UITestControl provides properties and methods which are generic to controls across technologies
Here is the complete video of the topic discuss Here is the code snippet discuss in the above video

public static void Button8Click()
{
    //Instance for WinWindow
    UITestControl calcWindow = new UITestControl();
    calcWindow.TechnologyName = "MSAA";
    calcWindow.SearchProperties[UITestControl.PropertyNames.Name] = "Calculator";
    calcWindow.SearchProperties[UITestControl.PropertyNames.ClassName] = "CalcFrame";

    //Button
    UITestControl btn8 = new WinButton(calcWindow);
    btn8.SearchProperties[UITestControl.PropertyNames.Name] = "8";
    Mouse.Click(btn8);

    UITestControl btn9 = new WinButton(calcWindow);
    btn9.SearchProperties[UITestControl.PropertyNames.Name] = "9";
    Mouse.Click(btn9);

    UITestControl btnAdd = new WinButton(calcWindow);
    btnAdd.SearchProperties[UITestControl.PropertyNames.Name] = "Add";
    Mouse.Click(btnAdd);

    UITestControl btn2 = new WinButton(calcWindow);
    btn2.SearchProperties[UITestControl.PropertyNames.Name] = "2";
    Mouse.Click(btn2);

    UITestControl btn3 = new WinButton(calcWindow);
    btn3.SearchProperties[UITestControl.PropertyNames.Name] = "3";
    Mouse.Click(btn3);

    UITestControl btnEquals = new WinButton(calcWindow);
    btnEquals.SearchProperties[UITestControl.PropertyNames.Name] = "Equals";
    Mouse.Click(btnEquals);
}

Thanks for reading the post and watching the video !!! Please leave your comments to improve the post. Thanks, Karthik KK

Post Author: Karthik kk

5 Replies to “Hand Coding Coded UI Test with UITestControl”

  1. Hi Karthik,
    Can you please post some video related to detecting the elements of a popup using hand coding for any application which starts as ‘Web Application’ — Click on some button –> Directs to WPF popup–> Now identify the elements in this popup window.

    Thanks,
    Kishor

  2. thanks karhtik, I learn lots from your videos.. but Its very useful when you provide download option on this portal for video ..because every time people don’t have internet ..please think on it ..

    thanks
    kiran shinde

  3. I don’t know How to test a project. Can I know How to start learning from beginning.

    Please let me know .

Leave a Reply

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