QTP: An issue with descriptive programming

I’ve been building some test components for our products lately, and noticed something…unusual. I often use descriptive programming to get around issues with environment, since typically our environments have very similar code. Some of the items I use are very reliable; things like the <TITLE> tag are usually pretty good, and don’t change often here.

However, I noticed something interesting with this process. We have a page that simply isn’t recognized via descriptive programming. I can record and play it back (just to debug my code; not for use), but using the title property to get at it descriptively won’t work. Now, naturally, I am driven to figure out why. I don’t like not knowing.

While I am on the topic, note that the error produced by this “confused” QTP is “General Run Error” which translates to mean “I have fallen, I don’t know why, and I can’t get up”.

I altered the title field a few times, and this is what I have determined: descriptive programming can’t seem to handle more than one space at a time. We have a page where the title is broken up with the | character and multiple spaces. An example of this might be “Start Page | Here”. If you removed the spaces, it works just fine. At first I thought perhaps the pipe character was troubling it, but it seems to work fine when I use “StartPage|Here”.

So, when you have space issues, you might have to use some alternative property to get the page. I’ve had success with building an expected URL dynamically, and using it with my descriptive programming. Not as eloquent perhaps, but much more reliable in our architecture.

Also, I’ve been working on an alternative to using datatables involving disconnected ADO recordsets. More on that to come.

«March»
SunMonTueWedThuFriSat
2627281234
567891011
12131415161718
19202122232425
2627282930311
2345678