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

Microsoft Ribbon for WPF

7 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stanislav
Top achievements
Rank 1
Stanislav asked on 02 Nov 2012, 05:41 AM
Hello all,

Is there any possibility to automate Microsoft Ribbon for WPF control using Telerik testing framework?
Link: http://www.microsoft.com/en-us/download/details.aspx?id=11877

Thank you.

Kind Regards,
Stanislav Hordiyenko

7 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 07 Nov 2012, 09:05 PM
Hi Stanislav,

Yes our Telerik testing framework can be used to automate the Microsoft Ribbon for WPF control. It won't recognize it as the complex Microsoft Ribbon for WPF control, but will recognize the individual WPF elements (text blocks, buttons, etc.) that are used to make up the complex controls.

Greetings,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 07 Nov 2012, 10:18 PM
Hello Cody,

Thank you for your answer. This is what I have been doing these days on a lower level of test automation. I would like to ask you whether it possible to write my own translators for custom WPF controls? If yes, where I can find information how to do this?

The last time I wrote a simple wrapper for the RadBusyIndicator control:

public class RadBusyIndicator : WpfTestElement
{
    private static AutomationProperty isBusy = new AutomationProperty("IsBusy", typeof(bool));
    private static AutomationProperty progressValue = new AutomationProperty("ProgressValue", typeof(double));
    private static AutomationProperty isBusyIndicationVisible = new AutomationProperty("IsBusyIndicationVisible", typeof(bool));
    private static AutomationProperty isVisible = new AutomationProperty("IsVisible", typeof(bool));
 
    public bool IsBusy
    {
        get
        {
            return (bool)this.GetProperty(isBusy);
        }
    }
 
    public double ProgressValue
    {
        get
        {
            return (double)this.GetProperty(progressValue);
        }
    }
}

But I am looking for some manual to write more complex wrappers.

I look forward to hearing from you.

Kind Regards,
Stanislav Hordiyenko
0
Cody
Telerik team
answered on 12 Nov 2012, 02:13 AM
Hi Stanislav,

I would like to ask you whether it possible to write my own translators for custom WPF controls?

Writing a translator that works like our other translators that come with Test Studio is not an easy task plus we haven't published the API interface you would need to do so. Instead I suggest you look into writing your own "wrapper class" i.e. an independent class that you can instantiate in code and use the methods in it you define.

But I am looking for some manual to write more complex wrappers.

You code sample looks like a good base start. I am sorry but we don't have any such manual. We'll be glad to help when you get stuck on a specific area/function.

All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 20 Nov 2012, 10:16 PM
Hello Cody,

The name of the wrapper class should be the same as XAML tag name (e.g. RadBusyIndicator class has the same name as its xaml tag element) of the element in the application? Is it possible to specify somehow the XamlTag of the search element in WPF application? I have faced with an issue when there is already a wrapper with the same name in your library.

Thank you in advance.

Kind Regards,
Stanislav Hordiyenko
0
Cody
Telerik team
answered on 20 Nov 2012, 11:37 PM
Hello,

The name of the wrapper class should be the same as XAML tag name

Why? There's no technical reason you must do this. Perhaps for naming convention only it makes sense. Just don't put it into the same name space as ours i.e. don't put your RadBusyIndicator in Telerik.WebAii.Controls.Xaml.

Is it possible to specify somehow the XamlTag of the search element in WPF application?

To search by XamlTag use something like the following:

ActiveBrowser.SilverlightApps()[0].Find.ByExpression(new XamlFindExpression("XamlTag=gridviewvirtualizingpanel", "automationid=PART_GridViewVirtualizingPanel"));


Regards,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Stanislav
Top achievements
Rank 1
answered on 21 Nov 2012, 12:18 AM
Hello Cody,

I think I was not clear in my question. When I try just to find the first RadBusyIndicator in the WPF application, and the wrapper class is not the same as XamlTag, then it couldn't be found. Once I rename the class name to RadBusyIndicator, the code returns me the first element.

.Find.ByType<RadBusyBusyIndicator>() //returns nothing
.Find.ByType<RadBusyIndicator>() // returns the first element that was found in the form

So, my question was is it possible to name the wrapper class in unique way and specify in the class which XamlTag should be used while searching the element in the form.

I look forward to hearing from you.

Kind Regards,
Stanislav Hordiyenko
0
Cody
Telerik team
answered on 21 Nov 2012, 04:21 PM
Hello Stanislav,

If what you're trying to do is replace our own RadBusyIndicator class, I think you'd be better off adding an Extension method to the existing class instead.

All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Stanislav
Top achievements
Rank 1
Answers by
Cody
Telerik team
Stanislav
Top achievements
Rank 1
Share this question
or