TestComplete 7 is packed with a lot of improvements and cool new features and we couldn’t be more excited about it, to say we’re ecstatic about TestComplete 7 is an understatement. We’d like to point out the most exciting features added to TestComplete, just to make sure you don’t miss them. In this blog post, I’ll demonstrate the automated test recording enhancements in TestComplete 7 — automatic name mapping, descriptive names of script variables, disabling variables in recorded test scripts, and adding tested applications automatically!
Automatic Name Mapping
Object name map is an essential part of many TestComplete projects. It saves you from rewriting automated tests when object recognition properties (e.g. class name, caption or index) change between builds and also makes your automated tests shorter and easier to read.
In earlier versions, if you wanted to record automated tests using mapped object names you had to map the appropriate objects prior to recording. For large apps with thousands of objects, this became a tedious process and we understood the need for change. With the new automatic name mapping feature in TestComplete 7, you don’t have to worry about that anymore! You just start recording your automated tests — and while doing this you get all of the tested objects mapped to descriptive names using the most appropriate property values, automatically.
Here’s a sample Notepad object map that TestComplete 7 automatically created during recording:
Automatic name mapping is enabled by default and can be turned on and off using the Map object names automatically option in the Engines | Name Mapping category.
Recording Descriptive Variable Names
Before TestComplete 7, editing recorded test scripts was a lot harder because of all of those unintuitive
w3 variables, which were not easy to keep track of. Understanding which variable held which object was also complicated by numerous variable reassignments. TestComplete 7 improves this situation by recording descriptive, “smart”, variable names that are based on the type and caption of the objects being referenced:
btnOpen, etc. For applications that TestComplete can see their internal objects, TestComplete records the variable names as the actual object names defined in the application code. This way, the recorded test scripts become more readable, understandable and easier to modify.
Here’s a sample automated test script recorded with descriptive variables, compared to the same script with non-descriptive ones:
TestComplete 7 generates descriptive variable names in recorded test scripts by default. The recorder option that controls this behavior is the Smart variable names option in the Engines | Recording category.
Disabling Variable Usage during Test Script Recording
Another test script recording enhancement is the possibility to prevent TestComplete from using variables to store references to recorded tested objects. Instead of this, TestComplete will address all tested objects in the recorded script by their fully-qualified names (or mapped names/aliases). This is what it looks like:
You may want to disable variable usage if object aliases in your object name map are short enough to ensure script readability. Test scripts recorded without variables can also be easier to modify and it makes it easier to introduce your own variables.
To activate the described behavior, you can use the Do not generate variables option in the Engines | Recording category.
Adding Tested Applications Automatically
Before TestComplete 7, you had to have your tested application added to the TestedApps list prior to recording an automated test, so that once you started recording the application could be launched directly from the Recording toolbar. This was the only way to record the
TestedApps.AppName.Run command, which is the most stable and therefore recommended way of launching tested applications.
TestComplete 7 adds a new option to automatically add any application launched during test recording to the project’s TestedApps collection. Whether you launch an application from the desktop or Quick Launch link, via the Start menu or the Start | Run command — TestComplete will add that application to TestedApps and record the
TestedApps.AppName.Run command instead of the actual user actions that led to the application start.
This handy feature saves time and lets you launch the tested application during recording sessions in your favorite way rather than from the Recording toolbar. It is especially useful for novice TestComplete users, who are not aware of the TestedApps project item.
The option for the described behavior, Automatically add applications to the Tested Applications list, is located in the Engines | Recording category and is turned on by default. Also, the Show the 'Add <ApplicationName> to the list of tested applications?' message option of the General | Show Again Flags category specifies whether TestComplete should ask you before adding a certain recorded application to TestedApps.
With each new TestComplete version, we not only add new features, but also try to make automated test development easier, faster and more customizable to testers’ needs. An example of these are test recording enhancements made in TestComplete 7: automatic name mapping and adding tested applications simplify project setup, while new variable recording options improve maintenance of recorded test scripts.
We hope you enjoy TestComplete 7 and look forward to your feedback. If you haven’t tried TestComplete 7 yet, download and try it today. And stay tuned for more new feature highlights!