Microsoft UI Automation Library Vs Coded UI Test

前端 未结 4 1821
难免孤独
难免孤独 2021-02-05 20:57

I\'m very much new to Test Automation kind of thing. Recently I\'ve been assigned to a project where I have to write an application (or, a script may be, I\'m not s

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 21:29

    Basically Microsoft UIA is the new accesibility library in .Net 4.0. WPF applications and controls have built-in support for UIA through the AutomationPeer class.

    Coded-UI test is a Record & Play automation tool which uses the Microsoft UIA Library underneath. Since being a tool compared to writing code in C# it improves QA productivity for recording more test cases.

    For applications with automation support planned into it, Coded-Ui should be sufficient. If the AutomationIDs are missing make sure the controls have some unique property like Name. Use UIVerify or Inspect to check for this.

    If NO unique property is avialble, there are the other below mentioned techniques you can use in combination with Coded-UI.

    • From an Event When your application receives a UI Automation event, the source object passed to your event handler is an AutomationElement. For example, if you have subscribed to focus-changed events, the source passed to your AutomationFocusChangedEventHandler is the element that received the focus. For more information, see Subscribe to UI Automation Events.

    • From a Point: If you have screen coordinates (for example, a cursor position), you can retrieve an AutomationElement by using the static FromPoint method.

    • From a Window Handle: To retrieve an AutomationElement from an HWND, use the static FromHandle method.

    • From the Focused Control: You can retrieve an AutomationElement that represents the focused control from the static FocusedElement property.

提交回复
热议问题