2

I’m looking for alternative for existing tests written in QTP for my Win32 application written in Borland C++. My candidate is White which based on UI Automation because it’s native solution, I can create my tests using .NET/C# and easily integrate it with nUnit and Hudson.

White http://white.codeplex.com

MS UI Automation http://msdn.microsoft.com/en-us/library/ms747327.aspx

UI Verify http://uiautomationverify.codeplex.com

I use UI Verify as a spy to identify properties of objects I want to find in my tests. More or less when I can see something in the spy, I can find it using UI Automation/White. Generally I don't have much problems with recognizing objects but when I try to search some content inside the tab contained in Tab Panel or try to see MenuItems of Menu bar then the problem appears.

UI Automation/UI Verify works wired. When I run UI Verify (1.0 version) I see that objects can be registered properly only then when I set 'Focus tracking' option and click on target objects or change the keyboard cursor on them. Otherwise it's impossible to find them. UI Verifier can show me children of my 'tab' panel then. But I can’t find them using UI Automation/White. This is example code:

Tab tab = window.Get(); ITabPage tabPage = tab.SelectedTab; AutomationElementCollection newCol = tabPage.AutomationElement.FindAll(TreeScope.Descendants, Condition.TrueCondition); window.Get("buttonName");

the collection is empty even though spy see the children.

  1. Does any of you have some experience with White/UI Automation library that he/she would like to share with me?
  2. I want to implement the tracking feature from the spy to my tests. Can you help me with that? I'm trying to study the code of UIA Verify spy. I think that there are two classes responsible for catching the objects: FocusChangeListener and FocusTracer - this is the code:

http://uiautomationverify.codeplex.com/SourceControl/changeset/view/9992#214260 http://uiautomationverify.codeplex.com/SourceControl/changeset/view/9992#214192

Requirements: 1. Windows SDK 2. .NET 3.5 3. White 4. UIA Verify code

  1. Do you have any better alternative for White/UI Automation?

R.

4

1 回答 1

1

您,R 或 YoYo,能否将您的表单编译后或放在源代码中(最好没有内部逻辑)放在文件共享的某个位置?如果 UIAVerify 看到它,我从未见过使用 UI 自动化不会捕获的控件。我看到了这样的窗口,只能用 UIAVerify 的 Focus Tracking 功能捕捉到。在这种情况下,这样的窗口是 UI 自动化搜索无法触及的。

关于控件,您确定您遇到的控件具有 Name 属性吗?也许,这是一个只能通过 ValuePattern 而不是 Name 的值?

于 2012-04-19T14:15:38.710 回答