Creating a simple test

In order to test the AXExtension, it will be important to create little tests involving the specific control you are interacting with. Later on you will want to interact with a full system to make sure the filter does not break any other behavior, but during development this just slows down the process.

Before beginning this process, open Dynamics AX (or another system to test, if you are just here for the CUIT itself).

The project type we will create is "Coded UI Test Project" in \Templates\Visual C#\Test. Name it whatever you like, but the name used in this guide will be SimpleCUIT. Go ahead and hit OK to create it.

When the project is created, a window titled "Generate Code for Coded UI Test" opens. Just click OK: this will allow you to start recording a test straight away.

After you hit OK, visual studio will minimize and open the Coded UI Test Builder. There will briefly be a short help tooltip. We'll want to go ahead and click the red record button. As you might imagine, this begins recording. After clicking it will turn into a blue pause button.

After hitting record, click on the "Global address book" link, then hit back to come back to the area page. Hit pause when you're done. This is obviously an extremely simple test: the intent of this guide is more to do with understanding the UI of tests rather than how to make complex tests.

Now hit the button with lines and an arrow on it. This is the button for generating code from the UI actions just recorded. If you want to review the steps recorded before generating code, use the button that looks like stair steps.
Once the generate code button is clicked, a window will open asking for a name and description. The name isn't important in this simple example, so go ahead and click Add and Generate. Then close the recorder by hitting the X button.

Visual Studio will be restored when you exit the recorder. It now has a set of autogenerated code inside. Most of it isn't relevant. The important part is the CodedUITestMethod1() method. This is the default test method created in a new CUIT project. Inside you'll see a call to RecordedMethod1(), the method we just created. If you run this test, you'll see it repeat the actions we recorded earlier.

When you create a recording like this, you are generating information in the UIMap. The UIMap stores
information about the items you clicked and the methods which replay your actions on them. The UIMap can be interacted with using a helpful visual interface. To look at this, double click on the UIMap in your project. In the visual interface, you can see the recorded method on the left, and the recorded structure on the right. When you click on an action or a ui element you can view and alter its properties in the lower right hand corner.

Last edited Jul 29, 2014 at 3:25 PM by wgoodin, version 5