Do you wonder if there are any keys to get easy test automation over the RadControls components?

I’ve seen people asking about how to get a simple (at a first glance) task done through this or that test automation tool and we generally find the specific resolution with the exact tool in use. However, in most cases the things are quite similar no matter which tool you prefer. Instead of posting particular solutions though, with this post I’m sharing some of the trickiest moments one may came across while working on tests automation of RadControls for ASP.NET (AJAX) and the general solution. That is to say the questions/answers below are component-related and are not something concerning the specific test automation tool.

I won’t surprise anyone here pointing that the ASP.NET (AJAX) suite of Telerik controls provides rich client-side functionality. The controls expose JavaScript functions/properties/events that are giving huge amount of options for the final implementation. At the same time, you should not care what’s behind the scene at all. Each component’s documentation of course describes its API in details.

Ah, did I say something about a key in RadControls ASP.NET (AJAX) tests automation? Here it is – the client-side API.

So, which are the top trickiest moments in those controls test automation I’d like to share? Let me start with a common task regarding the rich text editor – setting custom content. You know, the RadEditor is one of those giant components, which does so much behind the scenes on the client, because of its rich client-side functionality.

  1. RadEditor

Hello, Telerik! We're using the tool X  to test our ASP.NET (AJAX) application. Whenever we encounter a page with the RadEditor on, X cannot enter text in the editor.   X recognizes the frame where the editor is placed, but it cannot push text to the editor.

I remember I’ve been looking into a nice test automation tool with a colleague of mine. He didn’t like it that much saying: “Look at this, even its recorder cannot work with the Editor!”

Nice try! What I answered was there is no tool which would automatically work with the editor. No, that’s not correct, there is no tool, which would automagically work with any rich-text editor. So I don’t know about X, but RadEditor supports … all the good tools out there. ;)

What can you do to change the rich text editor content through an automated test? Take a look at its client-side API and the method set_html() (SetHtml() for the ASP.NET version). As long as your tool provides the ability to execute some custom JavaScript, you just need to access the client-side object and call the function with your content as argument and voila, you get the editor HTML updated. You can also get the editor HTML by get_html()/GetHtml() methods.

  1. RadInput

Hey, Telerik! When I try to set a value in a RadInput control with the tool Y, the value I set is immediately cleared out on exiting the field. I have tried numerous ways of setting this value, all with the same effect.

Yes, the RadInput controls perform some JS validation on the client so although those are not so complex components as the RadEditor, you can’t just find the input element and set/replace its value. Instead, (guess what?) use the Client-Side API and the set_value() function in particular (SetValue() in ASP.NET version). Again, you can verify the RadInput value by get_value()/GetValue() methods.

Okay, here comes the funny part:

  1. RadComboBox

Good day! How do you select an item of the ComboBox manually through an automated test written with the Z tool? I’ve written such a test, which clicks on the combobox arrow, the items are displayed, then the test clicks on the item I choose, but it does not get selected! I do it myself over the demo and it is selected as expected! What is going on here?!

As some fellows noticed, the trick is first to highlight the item and then click it. Otherwise the click action over the item does nothing.

ComboBoxHighlightItem

That’s not specific to Selenium of course as you can see in the WatiN solution shared by my colleague Elena.

Let’s stop here for now and see what trick you’ve stumbled upon while doing some tests automation over your RadControls applications. Did you get an issue and want to share the solution you’ve found?

Thanks!

Konstantin


Related Posts

Comments

Comments are disabled in preview mode.