Have you ever tried to automate dynamic interfaces and complex AJAX applications using the conventional automation testing tools? If the answer is “Yes”, you’ve most probably run into some difficulties in getting the proper reference to the dynamically created HTML objects once the DOM tree has been modified. Usually, a number of workarounds are necessary in order for your code to find the proper HTML element. This nightmare could even be a deal breaker when evaluating one tool or another.
I know because I am one of the QAs at Telerik’s ASP.NET teams and I have to test and develop tests for our RadControls every single day. I’ve tried multiple tools to automate a part of my job, but one of them has made my life particularly easy. This is why I decided to write this blog post and walk you through the common problems you might meet when testing AJAX applications and how you can easily solve them with Telerik Test Studio.
ASP.NET and AJAX applications have QAs face two major challenges:
Take the MS Coded UI Testing Framework for example. In order to get it to test an application that involves these scenarios you need to:
Telerik Test Studio allows for more effective test automation in terms of recording, executing and debugging functional tests. It has the options for creating both recorded and coded tests.
There is an easy way to get around at least two major obstacles when developing automated tests on ASP .NET AJAX controls by means of Telerik Test Studio.
In such cases the ID of the tooltip control is generated dynamically so once the test is recorded with a certain ID it would fail during the execution because each time the tooltips are created, their IDs will be different.
Test Studio allows you to change the find expressions from the hardcoded “exact match” operator to “contains”. This is easily done through the built in element explorer dialog:
And not a single line of code was written that day :)
This approach can be used for all kinds of content, from our RadControls to any custom content you generate.
You have just seen it – Test Studio works seamlessly with Telerik’s controls for ASP .NET AJAX - the Test Studio solution provides wrappers and translators for each of them. These integrated adapters are specially designed for automatically identifying the control and exposing its API for the purpose of making the functional testing easier by extending the default list of verification and action steps that are available for the standard HTML elements.
A typical example of the common properties that could be exposed and added as a “verification” or “wait for condition” step with single click can be seen on the following picture:
You can even create wrappers and translators for your own controls and tools, plug them in and create your tests without breaking a sweat.
Here is what each package brings:
Mihail Parvanov has been working as a Senior QA engineer at Telerik’s ASP .NET AJAX division since 2010. He is responsible for developing the automated test infrastructure for one of the RadControls teams. Apart from work, Mihail’s main interests include riding a bike, playing volleyball or travelling with friends.