TestComplete - A Novice’s Guide to Being a Novice
Test and Monitor | Posted March 28, 2013

My first experience in test automation was Jan. 24, 2013 - my first day at SmartBear. After two months of using TestComplete, I've found three things that create a recurring theme in my workday. From one novice to another, here are the three things to keep in mind while automating with TestComplete.

 

Beauty is in the eye of the beholder, so is application structure

The first lesson that I learned in using TestComplete is the difference between how I see an application versus how TestComplete sees it. 

When I first encountered this issue I was slightly flummoxed as to what was happening. In my test, I wanted to verify the text of a selected item from my food pyramid app. Whenever I tried to select the glazed donut, TestComplete kept highlighting the entire tree, rather than the node I was hovering over. Why can’t you select just the doughnut I want? It’s right there, computer, under my mouse, where I am clicking. Why can’t you see it!?! Argh!

Then my boss let me in on the secret: Look at the application as the computer sees it

To me, as a human, I was trying to verify one (very tasty) node in a tree. To TestComplete I was trying to verify an aspect of a tree object. It's a subtle difference, but once I understood the concept it changed my perspective.

TestComplete TreeNot exactly what I wanted TC...

What I didn't realize was that the each node was a property of the tree instead of its own individual object. To my human brain, I was selecting an exact branch to verify. So while I thought I was telling TestComplete to check a specific node, TestComplete was hearing check the properties of this tree.

Now that I know that the nodes existed within the tree, I was able to tell TestComplete how to find the specific node. Using the TestComplete checkpoint wizard I was pointed in the direction of a property checkpoint to verify the donut node of my choice. Expanding the Nodes property of my tree, I found that SelectedNode had a text property of Glazed. Voila! My checkpoint was now able to successfully verify that I had selected the best donut in the world.

TestComplete and I were looking at the same object but we saw it in two very different ways. Now whenever I am setting up tests and am not able to select the exact item I desire, I stop and try to see the application as TestComplete sees it, and I am generally able to overcome that problem. We have an excellent support page about using checkpoints to verify object properties if you'd like to read more about this operation.

 

Name Mapping – A map of names?

Learning a new piece of software isn’t always easy. Sometimes you have to learn the hard way. Now that I have learned the hard way, however, I can share my findings with you so you don’t have to. Let me paint a scenario.

My task was easy: Create a test that would be run by multiple people. Simple, right? Launching my application, I recorded logging in and out and looked to see what TestComplete created. TestComplete saw me typing in the passwordboxMaincontentTxtpasswor field… If that is the name of the password field, imagine what other object names are in the app. When you share a test like that with a co-worker, you will have five seconds before they pop into your cubicle asking "What is the textboxMaincontentIDuidtextfield used for?" My easy task looked like it needed a lot of supporting documentation. Not as easy.

Next, my supervisor had me do a more involved exercise: Record 25 tests against a simple application. Time consuming though it was, this was still fairly easy. After recording all my tests I was presented with an updated program and asked to run my tests against it. The new version had one small change, the app changed from orders.exe to order.exe. Not one of my tests passed. They all failed spectacularly, with an Object not found error. All that time spent creating tests out the window. Or was it?

It turns out the answer to both of my issues was to use the Name Map. One easy fix for each problem.

First, I learned how to create an alias of a control name. These let me change what TestComplete called each object in my tests. In a few quick clicks I'd updated all of my tests to contain names like UserNameField, PasswordField and LoginButton. Much easier for my team to understand. Take a look at our support page on using the name map to create aliases for a more in-depth look. For more information on using the name map to create aliases, take a look at our Aliases Object support page.

Second was the dreaded Object not found error. This error may look scary but all it means is that TestComplete is looking for a control that meets certain criteria and it could not be found. Using the name map we fixed the error quickly by telling TestComplete to use controls under order.exe instead of orders.exeThis helpful article talks about handling the object not found error.

Once I understood the correlation between TestComplete and the controls in my application I was able to fix a majority of the problems I had encountered. Now whenever I see an oddly named control or one of my tests cannot find an object I open the name map and smile.

      

SmartBear Films brings you ‘Online Help’ starring Nick Olivo

This is perhaps the best takeaway from my early use of TestComplete. On the SmartBear website there are a host of helpful videos and guides available to new users like us. This is one of the best places you can start learning to use TestComplete.

The first videos to watch are in the TestComplete Video Tutorials section. These videos feature my boss, the illustrious Nick Olivo, who is as much an expert on TestComplete as I am the novice. Over the course of five lessons he walks you through the basics of test creation. My first few days here were spent watching these, and from one novice to another, they really help give you a solid understanding of automated test creation.

After completing the lesson videos there are a series of feature/functionality specific videos. Each of these explores a different piece of TestComplete or testing concept and explains in detail how to utilize our software to enhance your testing. In fact, I still reference those videos when I come across a question on a feature I don’t use daily.

There you have it folks. From someone new to testing and new to TestComplete, these are the three things that I found most helpful. Looking at your application the way TestComplete will see it, using the name map to make your tests easier to read and maintain, and all the helpful resources available at smartbear.com! Hopefully these will make your life with TestComplete a little more fun.

Keep on testing!

See also:

 

 

Close

By submitting this form, you agree to our
Terms of Use and Privacy Policy

Thanks for Subscribing

Keep an eye on your inbox for more great content.

Continue Reading

Add a little SmartBear to your life

Stay on top of your Software game with the latest developer tips, best practices and news, delivered straight to your inbox