Testing WPF application with Coded UI

239 Views Asked by At

I have to test a WPF application using Coded UI and have edited the CodedUITestBuilder.exe.config file to increase the MaxLevelsForItemContainer level to 10 but the changes do not reflect in the TestBuilder itself.

1

There are 1 best solutions below

0
On

Your problem sounds the same as this bug already raised with Microsoft.

There, the user states

I edited the MaxLevelsForItemContainer keys [...but] the CodedUIBuilder still uses the default MaxLevelsForItemContainer.

Microsoft answers:

The behavior is expected per our design. MaxLevelsForItemContainer config is applied only on Item containers such as ListBox, ComboBox etc. The reason behind this is the items within it could be potentially virtualized during playback, so the recorder needs to capture the entire hierarchy during recording for it to de-virtualized each level and play back properly. In this scenario, there are only nested Groups (they do not have ItemContainerPattern support as to speak in UIA world). So the config does not apply for over.

The workaround over here is to handcode the test script to add all the nested controls in the search hierarchy.