views:

587

answers:

4

I'm using QTP 9.5 test my application written in Delphi. I got Delphi Add-in installed and QTP can identify Delphi controls. Most but not all, specially TLabel. QTP can not recognize this control and is being ignored by Object Spy. Any suggestion, tip, clues how to test labels ?

cheers !

+1  A: 

It can detect controls like TSpeedButton? If not, this can be a sign that Qtp cannot detect controls that descend from TGraphicControl and therefore doesn't have a window handle.

Fabricio Araujo
No, it can't detect TSpeedButton as well. Neither is TImage but it does not matter as we'll probably never need to test this control. But yeah, QTP probably can't detect controls inherited from TGraphiccontrol which is a bummer. Most of our testing will involve whether the labels have the correct texts or not.
+2  A: 

Have you tried with TStaticText instead of TLabel?
They are Labels with a Window Handle (descending from TWinControl instead of TGraphicControl) which means they can get Windows messages from the outside.
I'm guessing that it's your problem. (only a guess as I don't know QTP)

François
+1  A: 

You may be able to write your own Delphi extender for QTP to handle this. There should be a pdf in your QTP install path: C:\Program Files\HP\QuickTest Professional\help\Extensibility\DelphiExtensibility.chm and DelphiExtensibility.pdf.

Tom E
A: 

If you still have to test it "as is" you probably have to go a more hard-coded way addressing the parent of those controls.

A window object in QTP through its methods allows finding a rectangular area containing the text, or clicking on a text found. If it's an area on the screen with the big amount of labels you can dump a whole screen to the text file and go with the text file comparison. You can also normalize text retrieved before doing comparison.

This approach is less robust but you can improve it if calculating rectangles dynamically, without hard-coding points wherever possible.

Albert Gareev