Share via


Coded UI Test

Microsoft® Visual Studio® Team System 2010 introduces a new Test Template named "Coded UI Test".  It enables users to verify the functionality of their user interfaces. 

image

Coded UI Test is fully integrated into Visual Studio and the new Test Management features in Team Foundation Server. it supports the following tools.

  • Coded UI Test Builder allows users to record test actions and generate code for them. Generated code is re-factored into methods based on user gestures.

image

  • It also allows users to add UI controls to a UI Control Map and generate assertion code on their properties.

image

  • Coded UI Test has excellent integration with Team Foundation Server.
    • Users may generate code based on an action recording created in Microsoft Codename Camano and published to the Team Foundation Server.

clip_image008clip_image010

    • The Results of a test run may be published to Team Foundation Server. A bug may be created in Team Foundation Server from the results of a Coded UI Test run.
    • The Coded UI Test many be attached to a Test Case in Team Foundation Server.

clip_image012

    • Coded UI Tests may be run as part of a Team Build run.
    • Coded UI Test can be generated from Shared Steps created in Camano.
    • Coded UI Test can be data driven with data associated with a Test Case on Team Foundation Server.
  • Microsoft.VisualStudio.TestTools.UITesting API may be used to directly reference UI controls, perform actions and validate properties.

The underlying Action Recording Engine for Coded UI Test is shared with Microsoft Codename Camano.

The following sub-sections provide details on the features supported by the engine.

· Intent-aware, non-intrusive and resilient action recording: Instead of just capturing raw user actions, the engine has been designed to be intent aware. Set of actions are aggregated into equivalent action to provide an intent aware playback.

clip_image014

Additionally, the engine uses smart algorithms to accommodate changes in configurations like window resize/Minimize/Maximize, screen resolution changes etc to provide a resilient playback support.

· Strong UI technology and platform support: The engine supports a wide range of platforms out-of-the box covering thick client applications built with .Net technologies to latest web applications

  • Windows Internet Explorer 7.0 and Windows Internet Explorer 8.0
    • Support for applications written in ASP.Net, php, jsp, asp, Ajax, SharePoint and web 2.0 applications.
  • Win-forms Controls for Microsoft .Net framework 2.0, 3.5 SP1 and 4.0
  • Windows Presentation Framework (WPF) for .Net framework 3.5 SP1 and 4.0

Internally the engine uses features of IEDOM for recording actions on the web applications being tested via Internet explorer. It uses accessibility technologies in Windows to capture actions on AUTs. Specifically it uses Microsoft Active Accessibility (MSAA) for Win-form support and UI automation (UIA) for WPF support. Custom controls that are developed for Win-form and WPF that follow accessibility guideline are also supported.

· In-built sophisticated mechanisms for handling complex UI action recording scenarios

  • Fast Search: In order to be able to playback user actions, the engine must be able to search for the Control that was acted upon. It uses fast search algorithms to quickly identify the controls and take appropriate actions on them.
  • Wait For Ready Mechanism: When playing back an action the engine needs to know that the UI is ready to act on the next action. For example, if the application was navigating to a web page, the engine needs to wait for the navigation to complete before taking an action. The Wait For Ready mechanism provides this support by intelligently detecting the application’s readiness to act on the next action.
  • UI Synchronization: If the user acted on a control (e.g. a mouse click), the engine needs to ensure that the control actually did receive the input. UI synchronization feature provides this support to the engine allowing it to perform a more resilient playback.
  • Ensuring UI is Visible: In a fast-forward scenario, the UI element (e.g. a list box) that needs to be acted upon might not be visible (scrolled our) or hidden behind another window. This feature ensures that the element is visible before taking an action on it.

Extensibility Support: The engine has been designed with Extensibility in mind. We realize that there are scenarios where our default engine will not meet the needs of our customers. These include being able to test applications built on a different or new UI technology (e.g. flash) or certain application domains that require customized action recording support. Via our extensibility APIs

Comments

  • Anonymous
    January 21, 2010
    Hi Mathew Thanks for the help, the calculator application is working fine. Now I am looking on the actual application on which I need to do automation testing using VSTS. In this case, there are some objects whose properties are not identified by VSTS. In QTP there is Smart Identification by which we can forcefully identify properties of any object. Is there anything like this in VSTS also? Thanks & Regards Shweta

  • Anonymous
    February 07, 2010
    If you record actions with Coded UI Test Builder, we will record with coordinates and you should be able to play back. (but this will not be resilient). What is the intent of assigning properties to the objects? Can you elaborate?

  • Anonymous
    April 14, 2010
    The comment has been removed

  • Anonymous
    April 14, 2010
    You can right click on  ProjectA and choose Add -> New Item -> Coded UI Test Map. This will add a new uitest file to ProjectA and it will have its own designer.cs file. See http://blogs.msdn.com/anutthara/archive/2010/02/10/walkthrough-using-multiple-coded-ui-maps-in-test-automation.aspx for a more detailed description on usage of multiple UI Maps.

  • Anonymous
    April 14, 2010
    The comment has been removed

  • Anonymous
    April 15, 2010
    The comment has been removed

  • Anonymous
    April 15, 2010
    Please try out the tutorial here - http://blogs.msdn.com/mathew_aniyan/archive/2009/11/05/tutorial-coded-ui-test-beta2.aspx In my opinion, this will be easier than reviewing sample code.

  • Anonymous
    April 15, 2010
    Yes, this is the best tutorial to start with Coded UI Test. Install and Practice it , you can get some familiarity with this tool, for any queries this is the good place to ask. HAPPY LEARNING :)

  • Anonymous
    June 01, 2010
    The comment has been removed

  • Anonymous
    August 24, 2010
    I am writing an automated test for a WinForms ListView control that has items with several columns of data which must be verified. The problem is that Coded UI is not able to find the individual columns. Coded UI can find each row in the list as a ListItem, however none of these have child controls that correspond to the columns in the ListView control. I have also tried  UITestingUtilities posted at blogs.msdn.com/.../useful-set-of-utility-functions-for-coded-ui-test.aspx The UITestingUtilities seems like it could be useful, however when I call GetContent on the list or GetColumnValues values on the listitem I get: System.InvalidOperationException: The control passed is not a list view control.  [or list view item in the case of the list item] I am able to call GetColumnNames on the list (I am able to identify the column headings as separate controls anyway). The ControlType properties are idenitified as List and ListItem, respectively on the controls. The ClassName is WindowsForms10.SysListView32.app.0.33c0d9d.

  • Anonymous
    September 01, 2010
    How to Create a Console Application for CODED UI?

  • Anonymous
    September 01, 2010
    I want to create a Console application from where, references for Coded UI test to be added. I want to run the test from Console Application. Is that Possible?

  • Anonymous
    September 20, 2010
    Hi Mathew, Thank you very much for the valuable info. Currently i am trying to automate the testing and below is the error i am facing. CodedUI test automated build: when i run automated test in team build i get this error The 'useAgentDefault' attribute is not declared in event log. and in build test results below is the error message i got: Error calling Initialization method for test class Tailspin.Test.Model.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (go.microsoft.com/fwlink) If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (go.microsoft.com/fwlink) I am using the Microsoft VS2010 VPC and trying to run the codedUI test as part of team build. I have changed the test agent from service to process as mentioned in blogs, but still getting this error. Help/Info on this would be of great help.. Thanks in Advance, Nagaraj

  • Anonymous
    September 20, 2010
    Hi Mathew, I have one more question. Pls let me know whether VS2010 Coded UI test supports record and replay on Ajax based web pages built using Dojo 1.5 and jquery 1.4.2 Information regarding the same would be of great help. Thank you very much in advance, Nagaraj

  • Anonymous
    September 21, 2010
    Hi Mathew, Thank you very much for the valuable info. Currently i am trying to automate the testing and below is the error i am facing. CodedUI test automated build: when i run automated test in team build i get this error The 'useAgentDefault' attribute is not declared in event log. and in build test results below is the error message i got: Error calling Initialization method for test class Tailspin.Test.Model.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (go.microsoft.com/fwlink) If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (go.microsoft.com/fwlink) I am using the Microsoft VS2010 VPC and trying to run the codedUI test as part of team build. I have changed the test agent from service to process as mentioned in blogs, but still getting this error. Help/Info on this would be of great help.. Thanks in Advance, Nagaraj

  • Anonymous
    September 21, 2010
    Hi Mathew, Thank you very much for the valuable info. Currently i am trying to automate the testing and below is the error i am facing. CodedUI test automated build: when i run automated test in team build i get this error The 'useAgentDefault' attribute is not declared in event log. and in build test results below is the error message i got: Error calling Initialization method for test class Tailspin.Test.Model.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (go.microsoft.com/fwlink) If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (go.microsoft.com/fwlink) I am using the Microsoft VS2010 VPC and trying to run the codedUI test as part of team build. I have changed the test agent from service to process as mentioned in blogs, but still getting this error. Help/Info on this would be of great help.. Thanks in Advance, Nagaraj

  • Anonymous
    September 22, 2010
    The comment has been removed

  • Anonymous
    March 25, 2011
    The comment has been removed