TestComplete, like all AutomatedQA software, is completely extensible. Most of its functionality is implemented through plug-ins, which can be activated or deactivated, thus adding or removing the appropriate project items, scripting objects, etc.
The latest TestComplete update, version 6.50, introduces script extensions, which allows test developers to easily add new functionality to TestComplete. In this blog, I will tell you more about it.
What are Script Extensions?
Script extensions are exactly what they sound like -- they are TestComplete plug-ins developed using scripting languages. The code can be written in VBScript or JScript, or both. DelphiScript is currently not available.
If you are interested in TestCompletes extensibility options, you may have heard about the TestComplete SDK, which enables plug-in development with Delphi and Visual C++. The new script extensions approach is a lot simpler than using the SDK: you dont need programming experience, nor a special IDE. The range of tasks that can be accomplished with script extensions, however, is limited compared to traditional compiled plug-ins, but is still very exciting.
What can I do with Script Extensions?
Script extensions add two types of functionality to TestComplete: actions and scripting objects.
Custom actions become part of TestCompletes toolbars during test design and test recording, once an extension is installed:
The most obvious use of these actions is to create custom checkpoints and custom object validations. This alone would be a good reason to create script extensions, however, the range of use cases is a lot wider. Heres a short list of things you could do with custom actions:
Insert custom checkpoints
Display data-driven test wizards and generate the appropriate test code
Insert custom object validation code
Insert wait for object code for syncing the test run with the AUT state
Generate pair-testing code based on selected objects
Receive test type recommendations based on the selected object
Use commands based on your organizations test framework
Display interactive tutorials to help guide testers through testing methodologies and test creation
And much more!
In fact, possible uses of custom actions are only limited by the imagination and the ingenuity of the creator.
Custom objects become available for scripting purposes in TestComplete just like any other TestComplete object. Thus, they are a convenient way to expose common routine libraries to all test projects you work on. There are also other types of objects you could create:
Just like TestCompletes standard objects, custom objects along with their properties and methods are displayed in the Code Completion window:
Really, theres no difference between using TestCompletes intrinsic objects and objects made available from script extensions. Script extensions can even be used in other script extensions!
Script extensions are programmed in TestComplete VBScript or JScript. TestComplete means that besides intrinsic functionality of these languages, you can use the major TestComplete objects to perform the desired actions. The range of things you can do in the script extensions source code includes, but is not limited to, the following:
Address processes, windows and onscreen objects, get and set their properties, call their methods, etc. The methods for addressing open-app objects (e.g.
VCLObject etc) and waiting for objects (e.g.
WaitWinFormsObject etc) are also fully functional.
Display interactive forms and obtain the user input.
Generate script code.
Post messages, errors, images and other entry types to the test log.
Add files, XML documents, objects and images to the projects Stores and manage stored items.
Create and utilize instances of COM objects (e.g. Excel.Application) or objects that have scripting API (e.g. WshShell).
Implement conditional logic to customize the extensions behavior in different situations.
Do I Need any SDK for Developing Script Extensions?
No! Scripts and XML files that compose extensions can be written from scratch. To create these files, you can use any text editor, including Notepad. You can even use TestComplete to write the script extensions code.
Does TestComplete Include Script Extension Samples?
Yes, TestComplete comes with three script extensions: Clipboard checkpoint and Manual checkpoint add new checkpoint types; WMI object adds a new scripting object for easy access to WMI services. These extensions are included in the <TestComplete>BinExtensionsScriptExtensionsAQAScriptExtensions.tcx package. This file is a ZIP archive with a different extension. So you can unzip it and see the full source code of the checkpoints and the WMI object. Also, check out the Script Extension Tutorials section in the TestComplete documentation to learn how these extensions were created.
Try creating your own script extensions and let us know what you think about it. Feel free to leave your comments and suggestions.
For a complete list of new features and changes in TestComplete 6.50, see: