Enable Coded UI tests by default

7 posts, 1 answers
  1. Stephen
    Stephen avatar
    6 posts
    Member since:
    Mar 2014

    Posted 05 Mar 2014 Link to this post

    Hi,

    Not sure where this best belongs. Basically I am looking to change the default value of the EnableCodedUITests property for all controls that use it to true instead of the default false.

    I don't want to do this on a per control basis or a per project basis I want to do it globally.

    Thanks in advance for the help.
  2. Stephen
    Stephen avatar
    6 posts
    Member since:
    Mar 2014

    Posted 05 Mar 2014 Link to this post

    Hmm, can't seem to edit my post.

    Just to elaborate on this: The reason I wish to do this is because it would speed up development since I have to set them to true for each control to test using visual studio coded ui tests...otherwise odd things happen.

    As an example: If I run a test on a rad ribbon, if the rad ribbon does not have the control enabled then the mouse gets stuck on the tab of the ribbon.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 07 Mar 2014 Link to this post

    Hi Stephen,

    Thank you for writing and for your request.

    I would like to start with clarifying that Microsoft did not provide good support for CodedUI for third party controls and we do our best to provide such support when possible. Unfortunately, Microsoft relies on the same mechanism (MSAA) in the controls which are already used from Windows Narrators (Narrator, JAWS and more) and turning on by default this property will greatly affect them and every developer which use our controls should set explicitly this property to false in order to provide proper narrator support on the client machines.

    For this reason we decided to set this property by default to false.

    Regards,
    Peter
    Telerik

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  5. Stephen
    Stephen avatar
    6 posts
    Member since:
    Mar 2014

    Posted 08 Mar 2014 in reply to Peter Link to this post

    Hi Peter,

    First thanks for the reply. So is there no way of enabling the property to true?

    I can understand the reasoning behind setting it to false but if I can change it to true for myself that is what I would like to do.

    Regards,

    Stephen.
  6. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 10 Mar 2014 Link to this post

    Hello Stephen,

    Thank you for writing back.

    Since, we cannot set this property by default to true for the controls you should set it manually explicitly for these controls which will be included in your CodedUI tests.

    I hope this is applicable for your scenario.

    Regards,
    Peter
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  7. Stephen
    Stephen avatar
    6 posts
    Member since:
    Mar 2014

    Posted 11 Mar 2014 Link to this post

    Thanks Peter,

    This is what I suspected, that it wouldn't be possible. However I've come up with the following solution that (so far) is working nicely.

    foreach (var item in FindForm().Controls)
                {
                    try
                    {
                        if (item.GetType().BaseType == typeof(RadControl))
                        {
                            ((RadControl)item).EnableCodedUITests = true;
                        }
                    }
                    catch
                    {
                        continue;
                    }
    }

    I do expect to run into problems eventually with the above code but for the most part it does exactly what I want, it goes through each element and sets enable coded ui to true without the need to traverse old elements which would be time consuming.
  8. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 12 Mar 2014 Link to this post

    Hi Stephen,

    Thank you for sharing you solution with us.

    I can confirm that your approach to set this property is correct.

    Let me know if you have other questions.

    Regards,
    Peter
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready