QTP: Debug viewer gotcha

There are days when I want to start litigation to have the letters "Q", "T", and "P" removed from the alphabet, and today is one of those days.

Today's reason: The Debug Viewer

For those unfamiliar with the DV, it acts like a watch window in VS. It is convenient way to observe a test's behaviour and figure out what is happening. I use it often. I assumed it worked like the watch window, and it does to some degree. But not completely, it would appear.

Imagine that I have function 1 that calls into function 2. In function 1, I have some logic based on the Err object (e.g.,  If Err.Number <>0, then....) . In function 2, I have a variable named myVar. When I call into function2 from function1, let's say I add myVar to the watch window to see it's value, and it looks great. I exit function2, and of course, myVar goes out of scope. The DV reports that the variable name is undefined (which it won't btw if you don't use Option Explicit...for the love of the gods, NEVER work in QTP without setting Option Explicit!!!!), which is what I expect....BUT.....Err also recognizes the error! Yes, the DV feeds directly into the global Err object. So, even though there is no error, my evaluation fails because there is a variable unrecognized in the DV!!!!

<groan>

Try to imagine how many hours I wasted this morning figuring that out.....

posted @ Friday, June 13, 2008 12:03 PM

Print
Comments have been closed on this topic.
«December»
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910