Hello,
I'm trying to run coded UI tests against some controls within a XamDockManager that itself is within a Tab control. When I replay the test it fails, but only when the XamDockManager is placed within a tab control (which of course it is in the application I'm having problems with).
I have attached a small repro that consists of a 2 column grid, with a tab control and XamDockManager on the left and the same on the right minus the tab control. If you record a coded UI test against the right hand part of the screen it works fine, if you record one against the left side of the screen it fails.
In the attached project there are tso coded UI tests. The test project is set as the startup project and in order to replicate the issue you'll need to change the file paths to point to the tree.exe file wherever it builds on your machine.
Could someone give me an idea of how to sort this?
Thanks,
Morgan
Hello Morgan,
This is because of issue in the CodedUITestBuilder.
But you can work around this with this additional line after variables declaration
#region Variables
.......................
this.UIMainWindowWindow.UIBARStagingTreeCustom.Container = this.UIMainWindowWindow.UIItemTabList.UIWibbleTabPage;
#endregion
Best regards
Anastas
Hi Anastas,
I'm having a similar issue but the variable generated by the test builder already contains this hierarchical informational,
WpfButton uINewButton = this.UIAspenPlusV80Flash2HCWindow.UIItemCustom.UIItemTabList.UIB3HCurvesTabPage.UIB3HCurvesCustom.UIObjectmanagerGroup.UINewButton;
However, when playing back, it still can't find the button. I've tried manually set the container for this button, but no success either.
Please advise if there is anything I can do, my use case is just a button sitting on a tab page.
Hello Daniel,
If you send me a small application like morgansk, I'll try to help you.
With this code snippet I can't tell you where is the problem with your test.
Regards,
I've attached a simple example, which is trying to assert a checkbox in xamFeatureBrowser-xamDockManager-Composition Walkthrough-Button Visibility
The error I got is,
Test method TestProject1.CodedUITest1.CodedUITestMethod1 threw exception: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: TechnologyName: 'UIA' ControlType: 'CheckBox' AutomationId: 'chkClose' Search may have failed at 'tabViews' TabList as it may have virtualized children. If the control being searched is descendant of 'tabViews' TabList 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.
Please help taking a look, thanks.
I tried to create test for this checkBox, but CodedUI builder couldn't create the right map for me.
It's big mess in the auto generated map.
So it's very hard to automate the xamFeatureBrowser with CodedUI(if this is your task).
If your trying to automate your own application, please send me the real project.
It's not my intention to test the xamFeatureBrowser, it just happened to be similar to our real project.
I've put up another sample that can demonstrate this problem, please take a look, thanks.
Hi,
In your test you are trying to verify button's text, but this button is not visible. So first you have to start the application - I made this at MyTestInitialize... - this method is execute before test starts.
There you have to change the ProccessStartInfo string with project's path on your computer. For example:
ProccessStartInfo my = new ProccessStartInfo(@"C:\Program Files\WpfApp.exe");
Second, for CodedUI builder is so hard to generate the right map if your components in your application haven't got set Name="" or Uid="". So when I set Name="..." of all components in XAML, the codedUI generate the right map from the first time. I suggest you in future, when you writing test with codedUI builder to set names of all components in XAML of your application.
Look at the attached project.
Best regards,