Creating MS UI Test with the docking framework?

Docking/MDI for WPF Forum

Posted 10 years ago by eric
Version: 14.2.0610
Avatar

Hi all,

i am currently evaluating the docking framework and everythign looks good up to the point where i start to test how the framework behaves with UI test (microsoft UI test)

My test setup seems fine:

i am able to do my actionsI am able to extract a control and do a validation

BUT

when i run the test, it doesn't seem to be able to reproduce any steps that requires to interact with a control inside the docking framework. (all other controls outside the docking site works)

The test fails with the following error:

Test Name: TestActiPro2 Test FullName: SES.Modules.CrossSection.UITests.LocationsPanelTests.TestActiPro2 Test Source: D:\SESWork\TFS\DefaultCollection\CrossSectionsModule\Dev\Team1-TestActipro\Src\SES.Modules.CrossSection.UITests\LocationsPanelTests.vb : line 49 Test Outcome: Failed Test Duration: 0:00:11.8274248

Result Message: Test method SES.Modules.CrossSection.UITests.LocationsPanelTests.TestActiPro2 threw exception: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: TechnologyName: 'UIA' FrameworkId: 'Wpf' ControlType: 'Button' Name: 'Add Circuit' Search may have failed at 'ToolWindowContainer-4084e7e7-d538-4cba-a6b6-374c29...' Pane as it may have virtualized children. If the control being searched is descendant of 'ToolWindowContainer-4084e7e7-d538-4cba-a6b6-374c29...' Pane then including it as the parent container may solve the problem. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component. Result StackTrace: at Microsoft.VisualStudio.TestTools.UITest.Playback.Engine.IScreenElement.FindAllDescendants(String bstrQueryId, Object& pvarResKeys, Int32 cResKeys, Int32 nMaxDepth) at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindAllScreenElement(String queryId, Int32 depth, Boolean singleQueryId, Boolean throwException, Boolean resetSkipStep) at Microsoft.VisualStudio.TestTools.UITest.Playback.ScreenElement.FindScreenElement(String queryId, Int32 depth, Boolean resetSkipStep) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft) --- End of inner exception stack trace --- at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapControlNotFoundException(COMException ex, IPlaybackContext context) at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowComException(COMException innerException, IPlaybackContext context) at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, IPlaybackContext context) at Microsoft.VisualStudio.TestTools.UITesting.Playback.MapAndThrowException(Exception exception, String queryId) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindFirstDescendant(String queryId, Int32 maxDepth, Int32& timeLeft) at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.GetElement(Boolean useCache, ISearchArgument searchArg) at Microsoft.VisualStudio.TestTools.UITesting.SearchHelper.Search(ISearchArgument searchArg) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.FindInternal() at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.<Find>b__37() at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func'1 function, UITestControl control, Boolean firePlaybackErrorEvent, Boolean logAsAction) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.Find() at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyPrivate(String propertyName) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.GetPropertyOfType[T](String propertyName) at Microsoft.VisualStudio.TestTools.UITesting.UITestControl.get_Name() at SES.Modules.CrossSection.UITests.SES.Modules.CrossSection.UITests.UIMap.CheckAddCircuitButtonName() in D:\SESWork\TFS\DefaultCollection\CrossSectionsModule\Dev\Team1-TestActipro\Src\SES.Modules.CrossSection.UITests\UIMap.Designer.vb:line 189 at SES.Modules.CrossSection.UITests.LocationsPanelTests.TestActiPro2() in D:\SESWork\TFS\DefaultCollection\CrossSectionsModule\Dev\Team1-TestActipro\Src\SES.Modules.CrossSection.UITests\LocationsPanelTests.vb:line 52

Any ideas?

Comments (4)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Eric,

Coded UI Test has always had some issues working with our docking framework for some reason. What we've found is that when testing tool windows, make sure DockSite.ToolWindowsSingleTabLayoutBehavior=”Show” is set so that tabs are forced to show. When a tab is hidden (a single tool window in a container), different UI automation peer code path kicks in and has the tool window’s content be a child of the container instead. But this causes Coded UI to fail since Coded UI doesn’t seem to properly use the altered GetChildrenCore() results from the automation peer.

If that doesn't help, you might need to keep your tool window content hosted in a UserControl and UI test those UserControls independently of the docking framework.


Actipro Software Support

Posted 10 years ago by eric
Avatar

Hi,

Using DockSite.ToolWindowsSingleTabLayoutBehavior=”Show” didn't help.

Plus the test was already running on a panel that was tabbed.

What i find funny is that during my test setup i can snoop any controls inside any panels without any problems

(see image link: http://www.dumpt.com/img/viewer.php?file=pfoet2l8z0nolcp78pb0.png )

 

I am able to setup my test, set what value should a control should take. It is when i run the test that it fails.

 

Are you guys planning on fixing UI tests? To be honest this is one of the main reason why we are looking to move out of AvalonDock because this and nested docking site cannot be acheived.

Eric

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Eric,

We have tried in the past to get Coded UI Test working better but are honestly not sure what the problem is.  As you said, controls can be found ok during setup but then when rerunning things, it seems like it fails in certain scenarios.  It's be rather frustrating since the UI automation tree is correct per how we set it up.

If we work on restructuring the internals of our docking system, we will try and revisit this again.


Actipro Software Support

Posted 10 years ago by eric
Avatar

I understand, although for us this is kind of a deal breaker.

Thank you for your prompt replies!

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.