This project is read-only.

Coding Coded User Interface Testing

  • You have a version of Visual Studio that is capable of using Coded UI Testing.
  • You have an up-to-date version of Microsoft Dynamics AX that you are capable of testing.
  • A test project and test class should be created.

Working directly with the coded aspect of the Coded User Interface Testing (CUIT) you need to become familiar with the following items:

How to use the Coded UI Test Builder to inspect controls

pic1.jpgThe fastest way to get to the Coded UI Test Builder is to right click the code of your test.
Select "Generate Code for Coded UI Test"
Click "Use Coded UI Test Builder..."
{Ctrl+\, Ctrl+C} (focus must be on your coded section)

A small window will appear in the lower right hand corner of the screen titled "UIMap - Coded UI Test Builder"

Warning: Visual Studio will minimize to accomodate those that do not have multiple monitors.

At the center of the window is a targeting icon grab it and drag it to anything that you would like to interact with. <Windows Key>+I can also be used to target controls.

Once a control has been selected, The Coded UI Test Builder will popup a bubble above itself that contains all the properties that CUIT Builder gathered concering your selected item.

Thanks to the Dynamics AX team there are only 3 properties that you should need to use during your testing:
ControlType, TechnologyName, Name
The other properties can be utilized to achieve a more distinct match.

ControlType - directly correlates with which WinControl to use
TechnologyName - within Dynamics AX will typically be "MSAA" though there are a few controls from "UIA" that you may run in to.
Name - Dynamics AX Team has created distinct names for the controls throughout AX

The list of available controls


The Parent Control Type is
  • WinControl

All others inherit properties types from WinControl and have additional properties and methods consistent with the behavior of the control
  • WinButton
  • WinCalendar
  • WinCell
  • WinCheckBox
  • WinCheckBoxTreeItem
  • WinClient
  • WinColumnHeader
  • WinComboBox
  • WinCustom
  • WinDateTimePicker
  • WinEdit
  • WinGroup
  • WinHyperlink
  • WinList
  • WinListItem
  • WinMenu
  • WinMenuBar
  • WinMenuItem
  • WinPane
  • WinProgressBar
  • WinRadioButton
  • WinRow
  • WinRowHeader
  • WinScrollBar
  • WinSeparator
  • WinSlider
  • WinSpinner
  • WinSplitButton
  • WinStatusBar
  • WinTable
  • WinTabList
  • WinTabPage
  • WinText
  • WinTitleBar
  • WinToolBar
  • WinToolTip
  • WinTree
  • WinTreeItem
  • WinWindow

How to set the properties of the controls

Here is a coded example:

using System.Drawing;
using Microsoft.VisualStudio.TestTools.UITesting;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;

namespace AXTesting
    public class CreateASalesOrder
        public CreateASalesOrder()

        public void CodedUITestMethod()

            // Find Dynamics AX Window
            WinWindow DynamicsAXWindow = new WinWindow();
            DynamicsAXWindow.TechnologyName = "MSAA";
            DynamicsAXWindow.SearchProperties.Add("Name", "Microsoft Dynamics AX",
            DynamicsAXWindow.SearchProperties.Add("ClassName", "AxMainFrame");

            // Click selector
            WinSplitButton selectorSplitButton = new WinSplitButton(DynamicsAXWindow);
            selectorSplitButton.TechnologyName = "MSAA";
            selectorSplitButton.SearchProperties.Add("Name", "");
            selectorSplitButton.SearchProperties.Add("ControlType", "SplitButton");

            // Find the DropDown Window
            WinWindow menuDropDownWindow = new WinWindow();
            menuDropDownWindow.TechnologyName = "MSAA";
            menuDropDownWindow.SearchProperties.Add("AccessibleName", "DropDown");
            menuDropDownWindow.SearchProperties.Add("ControlType", "Window");


Actions that can be used on the controls


Last edited Apr 30, 2012 at 2:37 AM by rcsaxton, version 3


No comments yet.