This is a migrated thread and some comments may be shown as answers.

Access native properties of WPF objects

3 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sergi
Top achievements
Rank 1
Sergi asked on 24 May 2018, 08:59 AM

I am starting to evaluate Test Studio for developing UI tests (entirely from Visual Studio) on a WPF application.

One of the things I need to do is accessing the native properties of the WPF objects, namely the DataContext, or the bound Command for Buttons.

The Test Studio tests wills reside in the same solution where the WPF App code is, so I will have access to the classes. Will I be able to do any kind of casting? If not, will I be able to access the properties in a generic way?

 

Thank you.

3 Answers, 1 is accepted

Sort by
0
Nikolai
Telerik team
answered on 25 May 2018, 11:01 AM
Hello Sergi,


Thank you for reaching out to us!

Having the app's code and the test in the same solution will not enable you to cast a TestStudio framework object to a specific WPF control type. The app under test and the test itself are quite different entities. You can use the built in wrapper objects or create your own based on the control types you have. Any control property can be accessed via the AutomationObject wrapper, please note that TestStudio framework only traverses the app's VisualTree so the DataContext property will be returned as string representation of the underlying type(Type.ToString()), same is true for the routed commands. The API does support method invocation and property setting via the framework, so it really depends on your specific needs and the property types. 

Regards,
Nikolai
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Sergi
Top achievements
Rank 1
answered on 01 Jun 2018, 05:56 AM

Yes, That's the behaviour I was observing (the ToString() thing).

Thanks for your answer.

0
Elena
Telerik team
answered on 01 Jun 2018, 11:42 AM
Hello Sergi,

Thank you for getting back to us. I am glad to know the information shared by my colleague Nikolay was helpful to you. 

Regards,
Elena Tsvetkova
Progress Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Sergi
Top achievements
Rank 1
Answers by
Nikolai
Telerik team
Sergi
Top achievements
Rank 1
Elena
Telerik team
Share this question
or