Hybrid Coded UI Testing

In order to attain hybridization of coded and “Click and Record” CUIT, you will need to know and borrow principles from the other two methodologies.

There are ways to combine apects of the above methodologies and customize the functionality of CUIT:

Moving methods from the recordings
To move methods out of the UIMap.uitest for editing you will need CUIT editor. In order to use CUIT editor, you must download and install Feature Pack 2 from: http://msdn.microsoft.com/en-us/vstudio/ff655021.aspx

capture1.jpg

CUIT editor will allow you to move methods out of a recording and allow you to make manual changes and additions to the code.

Right-Click the method that you would like moved and select "Move Code."

capture2.jpg

After moving the code from the CUIT editor, there will be a new method in the UIMap.cs file. as shown below:

namespace TestProject1
{
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;
    using Microsoft.VisualStudio.TestTools.UITesting.WpfControls;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Input;
    using System.CodeDom.Compiler;
    using System.Text.RegularExpressions;
    using Microsoft.VisualStudio.TestTools.UITest.Extension;
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;
    using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;
    using MouseButtons = System.Windows.Forms.MouseButtons;
    
    
    public partial class UIMap
    {
        /// <summary>
        /// CloseAX
        /// </summary>
        public void CloseAX()
        {
            #region Variable Declarations
            WinButton uICloseButton = this.UIMicrosoftDynamicsAXDWindow.UIMicrosoftDynamicsAXDTitleBar.UICloseButton;
            #endregion

            // Click 'Close' button
            Mouse.Click(uICloseButton, new Point(7, 3));
        }
    }
}

Having the method available will allow you to make changes or additions to the method.


Manually editing the UI Maps

The UIMap.uitest is an xml file that is used to generate the UIMap.Designer.cs. The UIMap.Designer.cs is automatically generated and cannot be changed directly. The UIMap.uitest can manually be edited using the XML Editor.

Last edited May 1, 2012 at 4:03 PM by rcsaxton, version 5

Comments

No comments yet.