TestComplete 8.10: Enhanced Support for Silverlight 4 Applications
TestComplete 8.10 includes enhanced support for Microsoft Silverlight 4. Now, you can test these applications in both black-box and white-box modes. That is, the test engine can now access internal objects, public methods, properties and fields of Silverlight 4 applications prepared in a special way for automated testing.
In order for the test engine to be able to work with the application’s internals, you need to process your Silverlight module (.xap) with the tcAgPatcher command-line utility that is shipped along with TestComplete. After that, the test engine will have access to Silverlight objects and their public methods, properties and fields and you can use them in your automated tests. There is no need to modify the application’s source code.
To discover the hierarchy of Silverlight objects and their available methods and properties, open your Silverlight application in Internet Explorer or Firefox and then explore the application using TestComplete’s Object Browser panel:
As you can see in the image above, each Silverlight object in the Object Browser’s tree is now marked with the icon. This icon is used to distinguish Silverlight objects from objects of other types in the object tree and to show that the test engine can access internal members of the Silverlight objects.
To address Silverlight objects in TestComplete automated tests, you now use a new
SlObject method. Using this method, you can obtain a Silverlight object by its name, which was specified in the tested application’s source code, or by a combination of the object’s class name, caption and index in the collection of sibling objects with the same class name and caption.
Test objects returned by the
SlObject method contain helper methods and properties that TestComplete provides for all onscreen test objects, while retaining all public methods, properties, and fields of the Silverlight objects. As you can see in the image above, these internal members of application objects are shown in the Silverlight group on the Properties and Methods tabs.
Besides exposing controls of a Silverlight application, TestComplete also provides a special
SlApplication scripting object that is a wrapper to a Silverlight application’s main class that encapsulates application-specific functionality and inherits methods and properties of the
System.Windows.Application class. In addition to the members of this class,
SlApplication also contains the
SlClasses property. This special property provides a scripting interface to namespaces and classes that are defined in the assemblies included in your Silverlight application package (in the .xap file):
SlClasses property, you can now access static non-visual objects, their public members and even create the application’s class instances directly from your script code and make your automated tests more powerful. In addition to functional testing of your Silverlight application, this allows you to perform unit testing of the application’s internal classes and their members.
In addition to access to internal objects, methods and properties of Silverlight 4 applications, TestComplete version 8.10 also includes test objects that provide support for a number of Microsoft Silverlight 4 controls. These test objects contain additional methods and properties specific to the control type. They simplify simulation of user actions on the controls when performing functional testing of Silverlight 4 applications.
We hope that the above-mentioned enhancements will help you easily create more powerful automated tests for your Silverlight applications. If you are interested in testing Silverlight applications with TestComplete, download a free trial version of TestComplete now.