none
Coded UI - Accessing Properties of Extended Class

    Question

  • My team currently has an issue regarding accessing properties and methods of extended classes. Our goal is to
    find the running instance of a custom object and access its public properties and methods.

    We are attempting to test a Visual C# application which has several screens inheriting from a custom class.
    The custom class inherits from the Form class. The issue occurs because we initialize the object as a UITestControl object in order to identify the running instance of the object. Therefore, this object does not inherit or have access to the extended properties of that object.

    We have attached a brief example demonstrating this issue. We have a class Extension which extends the
    Form class. The Extension class is further inherited by a Windows form and displays a random number on the form at runtime. The random number is generated on every new instance of the Extension object.

    When the Coded UI test attempts to access the random number by referencing the DLL of the extended class, a new instance of the Extension class is generated, and therefore the random number observed by the Coded UI test does not match the random number generated by the running process.

    See the OneDrive link below for the example project.

    https://onedrive.live.com/redir?resid=D00F7A7CF4A2DE13!107&authkey=!AIV8ho0RLSP7Fak&ithint=file%2czip

    Thank you,

    JM

    Tuesday, January 26, 2016 10:12 PM

Answers

  • Hi JM,

    The coded UI test just captured the actions you run on your UI, as you said that if certain properties were changed at random, it couldn't find them if you run it for the next time, the real reason is that the coded UI test has the specific requirement: We have to use the unique property as the search property, if it is dynamic, it would really impact the test result by design.

    Thanks,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 28, 2016 6:02 AM
    Moderator