Test Level and Checkpoints in QuickTest Pro (9 and earlier)

We don’t use Checkpoints at all in QTP. They’re just not flexible to the degree that we need them to be.

Whenever you call a checkpoint, there’s a lot of stuff going on, very little of which you have control over. You can put in some things that make it more flexible, like regular expressions and comparisons to other output values, but in the end you have this big black box of stuff that you can’t really get at. Plus, in the end, you have a Reporter.ReportEvent that goes to the test results as a Pass or Fail, and you have no way to alter the strings.

The problem with that is, as I’ve said in previous posts, I want different tests to behave differently in different circumstances, but I don’t want to rewrite any of the code. When I’m not running deep or strict tests, I want the test results to be sparse, just letting me know when the broad strokes of the tests have been completed. The Test Results Viewer that comes with QTP is difficult enough to use (e.g. it doesn’t remember filter settings, etc.), so when I filter the test results based on pass/fail, I want to zero in quickly on the tests that were important to me when I ran the tests. Sometimes we use test actions as a means to an end, not an end in themselves, and in those cases I don’t want to see every detail.

I have a lot of other problems with the checkpoints as they are, but some of my problems may be a lack of education. My team abandoned checkpoints too early to really explore the ins and outs and what-have-yous (mainly because of the reporting problem), so I’d like to hear from anyone who is still using them and gets what they need out of them. I’ll state some of the problems below. I’m not 100% sure that I’m right on these, so pretend that with all of them I’ve added “This is the experience I’ve had, and I’ve seen no evidence to contradict it. If you have some knowledge to impart, by all means let me know.”

Some of these problems are:

  • The Standard Checkpoints seem to be very, very slow. It’s nice that you can look into specific object properties and all that, but the fact that it slows down the script is a real pain when you have a lot of them in there at once
  • For Table Checkpoints, you can’t be at all flexible in column or row checking. Our application allows the user to change the order of columns, etc., which means we need to
  • For Text checkpoints, you must specify the nebulous “text before” and “text after”, when, in my AUT at least, those things are seldom reliable or consistent
  • Worse yet, when it comes to localization, they’ll be in a different language. You could specify values from a data table, etc., but sometimes I would rather be able to say “the text to the right of the object with XYZ properties”, or “the text that is in this frame, and I don’t care about the words, only that the font color is red and the CSS class reference is std_WarnText”

Like I said, there may be other ways to do this, but I haven’t found them. When I have coded around things to shoehorn my checkpoints into working, I’ve often later found them to be very fragile. I had an occurrence recently of a long, drawn-out test script, that probably contained over a thousand lines of code. The one line of code that broke consistently and with no good error message was the one leftover checkpoint from my earlier days. I finally removed it and replaced it with our new, preferred method.

What is that new, preferred method? I’ll talk about that soon. To give you a hint, think about JUnit.

In the meantime I want to talk a little more about Test Level, and the different levels we’ve defined. There are 6 levels, and we’re retaining the option to have more. Each level gives an indication of how strictly it behaves, and how its behavior is recorded into the test results.

  • Test Level 0: Loosest testing possible. Try at all costs to be smart about selecting options, and just get through the code by any means necessary. Also, don’t log anything that’s not an error (and that’s a QTP Run error, not a “test failed” error)
  • Test Level 1: Be as loose as level 0, but report all non-errors as “micDone” entries in the results. This way, we’ve at least kept track of all the things we’ve done, but when you filter by Warnings and Errors, you’ll only get the stuff that was considered Very Important by the test developer
  • Test Level 2: Be as loose as level 0, but report all “smart” behaviors as warnings. When something doesn’t exist in a WebList and you have to guess at it by clicking the first non-empty string, report that fact as a “micWarning”. If the specified value was in the list, report it as a “micDone”
  • Test Level 3: Again, be as loose as level 0, but report all “smart” behaviors as “micFail”, and all correctly specified values as “micPass”
  • Test Level 4: This time, don’t be at all smart about how values are selected. If the developer specified something to be a certain way, report the problem as “micFail”, then exit the test iteration (like QuickTest would by default, except that the intent is to give very detailed error information about what we were looking for and what appeared instead)
  • Test Level 5: Same as Level 4, but exit all test iterations immediately

The nice thing is that you can ratchet up or down the Test Level as the test goes on. You can test shallow in order to achieve some sort of setup, like object or scenario creation, then knock it up a level or two when you start the really important part of the test.

Our company has tasked us with asking a bit more out of our automated tests than is normally recommended. We understand that you’re not usually successful when you try to do outrageously large regression tests, or to simulate manual scripts. But they want something in between “normal” automation and 100% regression coverage, and techniques like this allow us to move much closer to that goal than ever before.

The ability to take the same scripts that perform the low-level field validation, then employ them as “just a step along the way”, has been paramount. It takes a while to develop the initial tests, but the development gets faster and faster as we build our library. Then, with very little effort, we can build a smart suite that can be reused against new builds, against customer-deployed sites, and against new versions of the product.

And we don’t use Mercury’s checkpoints anywhere.

Next, I’ll post an example of another Smart method, the one we use for WebLists. It employs heavy use of Test Level to determine its behavior and logging.

Tags: , , , , ,

2 Comments for “Test Level and Checkpoints in QuickTest Pro (9 and earlier)”

  1. tester Says:

    When is later? I’m very interested in what you have to say about checkpoints and your work arounds.

    tester

    Reply to tester

  2. sheetal Says:

    Hi…..What is script for weblist…i dont want to use checkpoint..plz answer…

    Reply to sheetal

Leave a Reply