Avalondock and Microsoft UITests issue

Jul 18, 2013 at 9:31 PM

so I was trying to create automated UITest in visual studio and found that the control targeting tool is not able to recognize any controls hosted in Avalondock panels UNLESS it is tabbed with other panels.

Is this a known issue?

Jul 22, 2013 at 10:26 PM

You don't say what error you're getting, and to be honest I haven't tried it with floating windows. But we had to apply the following workaround to get coded ui tests to work at all with Avalon dock.

Aug 2, 2013 at 4:52 PM
Edited Aug 2, 2013 at 7:24 PM
Well I don't get explicit error. The sub control doesn't seem to be recognized UNLESS the pane is tab with other panes (see my video below).

I tried to do what is proposed in your link, but setting the MaxLevelsForItemContainer to a big number doesn't help.

Also I try to see if inspect.exe would recognize the control and this tool works properly.

I don't know what else I can try. It doesn't seem to be a avalondock bug but im not sure.

I have create an issue just so that I can attached my demo video:


Edit: I found someone talking about the template that could be in cause (maybe this may help?)

Edit #2: I found that if I use the avalondock ExpressionDarkTheme or ExpressionLightTheme then it works fine. All the other doesn't work
See here
Aug 26, 2013 at 3:35 PM
Any ideas on this? Is it a Avalon dock issue or Microsoft UITests? :/
Oct 23, 2013 at 2:59 PM
any update on this?
Jan 17, 2014 at 6:51 PM
We are also planning to create UI automated tests for Avalondock controls. Did you resolve your issues?

Any feedback will be highly appreciated.

Jan 17, 2014 at 7:02 PM
Sadly I never got any workaround for this and never got an update on the issue from the developers.

For now it seems that you should force to use the expression themes before running you UI tests otherwise it won't work.
Jan 17, 2014 at 7:08 PM
Edited Jan 17, 2014 at 7:16 PM
Thanks for your prompt reply. I will appreciate if you can provide some lights on how to use the expression themes. Does this should be done while development by developers? Being automated tester, I just write coded ui tests, so not sure where I can force these expression to be used inside CUIT.
Jan 17, 2014 at 7:18 PM
I'm not in front of my computer and I won't be for the whole weekend, so sadly I won't be able to provide any code snippet on how to do this.

Although switching the avalondock's is pretty straight forward, all you have to do is change the them property to use the expression theme instead of the default one (which is I believe aero).

I'm sure that a quick search on the discussion forum of this site will provide you with an example on how to do this.

Iotherwise it will have to wait to Monday for a more precise answer on how to acheive this.
Jan 17, 2014 at 7:24 PM
It looks like this should be done by developers, I will ask them to switch the theme.

Thanks again.
Jan 23, 2014 at 4:15 AM
I have changed expression theme to “light” as you have mentioned but still i am facing the problem
My code looks like this:
Here I am trying to get ui controls on each tab and name of each tab.

UITestControlCollection TabList = UIMyWindow.UIItemTabList.GetChildren();
foreach (UITestControl tab in TabList)
         foreach (UITestControl tab in TabList)
            tc.WriteLine("TabName---{0} ", tab.Name);
            UITestControlCollection tabChildren = tab.GetChildren();
            int i = 0;
            foreach (UITestControl ch in tabChildren)

                tc.WriteLine("childIndex={0}-----childName={1} ", i++, ch.Name);
But my Output looks like this: -----
TabName-- Xceed.Wpf.AvalonDock.Layout.LayoutDocument's
childIndex = 0------childName =
childIndex = 1------childName =
Any suggestions will be highly appreciated.