Custom translator

Thread is closed for posting
9 posts, 1 answers
  1. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 11 Nov 2009 Link to this post

    I am currently exploring the possibilities with the Q3 test studio. One problem that I found when recording tests is that my custom buttons are all identified as frameworkelements rather than buttons. Which of course means that I will not get the nice button related "Quick tasks" functionality in the recording surface. First I thought I needed to implement an automation peerfor my button (derived straight from the regular Button class but with one added method, see code below), but that did not help. Do I need to implement a custom translator for WebAii to make this work? Or is there just something wrong with my automation peer? Please take a look at the code and point me in the right direction.

    Thanks,
    /Henrik

    My button class:
    /// <summary> 
        /// This is a standard button, but with extended functionality to perform the click event programmatically 
        /// </summary> 
        public class GLSButton : Button 
        { 
            public GLSButton() 
            { 
                DefaultStyleKey = typeof (GLSButton); 
            } 
     
            /// <summary> 
            /// Allows "clicking" programmatically. 
            /// </summary> 
            public void PerformClick() 
            { 
                OnClick(); 
            } 
     
            protected override AutomationPeer OnCreateAutomationPeer() 
            { 
                return new GLSButtonAutomationPeer(this); 
            } 
        } 

    And the automation peer:
    public class GLSButtonAutomationPeer : ButtonAutomationPeer 
        { 
            public GLSButtonAutomationPeer(Button owner) 
                : base(owner) 
            { 
     
            } 
        } 

  2. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 11 Nov 2009 Link to this post

    Hello Henrik,

    Thank you for choosing to evaluate WebUI Test Studio.

    You really don't need to write any custom code to get a translator for the Button control. WebUI Test Studio is coming with built-in translators for all the standard MS controls as well as the RadControls (both ASP.NET and Silverlight).

    To be able to use the built-in translators, you need to make sure the "hover over and highlight" mode is turned on and the respective group of translators are enabled on your end. If the hover-over mode is on you should get a red (by default, otherwise customizable) rectangle hovering elements on the loaded application.

    I have attached a couple of snap shots to help you verify everything's fine on your end. Can you please check them out and see if those help? Here is the order:
    1. Check the hover over mode is on.
    if that doesn't help:
    2. Open the Design Canvas settings.
    3. Make sure the Silverlight translators groups match those from my capture.

    Should you need further assistance, please let us know.

    Best wishes,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 11 Nov 2009 Link to this post

    Yes, I have everything working just fine with the "hover and highlight" stuff. The radcontrols and button translators are enabled etc. It's just that I am not using the standard Button control for the buttons in my app. I am using my own class, GLSButton, that derives from Button. And it seems that this custom control is not correctly identified as being, in fact, a button. Instead it is identified as a FrameworkElement. I have attached a couple of screen shots of what happens when I hover and highlight the button, and also of the corresponding view in the DOM Explorer. So I'm guessing that I need to do something more to make the design canvas treat my GLSButton as any regular Button.
  4. Missing user
    Missing user avatar

    Posted 11 Nov 2009 Link to this post

    Hello Henrik,

    Thanks for the feedback. For custom Silverlight controls in general, if none of the current WebUI Silverlight translators are able to recognize the element, they default to Framework element, even though they may inherit from the basic Silverlight controls.

    We are working on streamlining the translator process to allow users to create and insert there own in WebUI for their custom controls.  In the mean time, if you could try using the Dom Explorer Window to possibly manually test as many parts of your control as possible.

    Greetings,
    Nelson Sin
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 12 Nov 2009 Link to this post

    Hello Henrik,

    In addition to the response from Nelson, I'd like to add you can always convert the test step to code and modify it as per your needs (like asserting each property of your button). You will just need to cast the framework element to Button (ArtOfTest.WebAii wrapper type) and get whatever you need.

    I've also posted a solution about extended Silverlight controls support in WebAii Testing Framework that is applicable for the Coded Tests in WebUI Test Studio as well. This same approach will come built-in (meaning no coding required) for WebUI Test Studio including an appropriate UI for a future release of the product.

    I hope this information helps.

    Sincerely yours,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 12 Nov 2009 Link to this post

    Sure, the DOM explorer is nice. I also realised that you can use CastTo<Button> on the FrameWorkElement. It is just not as convenient as using the quick tasks, so I hope you can solve the issue with custom controls.

    I also have a couple of suggestions in general:

    1. It would be nice if it was possible to switch the object selected in the "hover and highlight" panel from the DOM Explorer. Sometimes when hovering over an element it will highlight a border or something else that is a child of the element you are actually trying to focus on. If it was possible to select the correct element in the DOM Explorer and then get the quick tasks etc. for that element instead, that would be great. Or perhaps the "hover and highlight" panel could even be activated from the DOM explorer as a context menu.
    2. I am not sure whether this has anything to do with Telerik, or if it should be sent to ArtOfTest, but it seems that WebAii should be able to detect that a custom control is of a certain base class and treat it as that base class instead of just reverting everything custom to FrameworkElement. At my company we have created quite a few custom controls just to tweak the default behavior slightly or to give them a default style. Having to create custom translators for each of these custom controls will be a major undertaking. 

    Apart from these issues, the suite looks really good. Some more sample code would be nice though. And perhaps some articles on best practices when writing/recording Silverlight tests.

    /Henrik
  7. Answer
    Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 12 Nov 2009 Link to this post

    Hello Henrik,

    Thanks a lot for your feedback!

    We will surely work on improving the custom controls support in WebUI Test Studio.

    Regarding your suggestions:

    1. This is actually a bug we are aware of. The fix didn't come in the Beta though, but you can expect it in the next official update.

    2. That makes perfect sense. I'm sending your feedback to ArtOfTest.

    We will also work on more articles about v2.0 Silverlight support and general ones. You can subscribe to the Telerik Testing blog where we will post some useful articles. The ArtOfTest blog has already been exposed as part of the Telerik Blogs for our customers convenience.

    The official distribution of WebUI Test Studio will also include Sample Tests project containing recorded Silverlight tests running the RadControls Translators as well as detailed documentation about the translators -- the translators structure/hierarchy for each control, the verifications each translator exposes as well as the actions handled automatically. You can currently take a look at the ASP.NET AJAX Translators Sample Tests and Documentation for reference.

    I'm glad you liked the product. Should you have any other feedback, please let us know.

    Kind regards,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  8. Konstantin Petkov
    Admin
    Konstantin Petkov avatar
    1911 posts

    Posted 25 Nov 2009 Link to this post

    Hi Henrik,

    This is to let you know of the WebUI Test Studio v2.0 internal build labeled 2009.3 1124 we uploaded yesterday. It includes a lot of improvements including the two requested by you in this thread.

    1. You can right click on an element in the DOM Explorer and choose the "Lock on surface" option. This will give you the element recorder menu.

    2. The internal build provides complete built-in support for extended controls. For example if your custom button extends the standard Button, you will get the recorder menu of the Button hovering over your custom control.

    Should you have any other feedback, please feel free to share it with us. It is greatly appreciated!

    Kind regards,
    Konstantin Petkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. hwsoderlund
    hwsoderlund avatar
    419 posts
    Member since:
    Aug 2006

    Posted 27 Nov 2009 Link to this post

    Sounds good! I'll give it a try. Thank you!
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!