preload

It does (but it doesn’t)

Posted by Albert Gareev on Jul 03, 2009 | Categories: Tools

There are no news in that but it’s the problem I have just faced first time – QTP doesn’t support the application, in any matter.

Although it is declared it does support Delphi applications in fact it doesn’t support until you get a special build. The following is a recommendation how to get one (origin: QTP help).

Enabling Communications Between QuickTest Professional and Your Delphi Application

You must use the MicDelphiAgent.pas module to enable communications between QuickTest Professional and each Delphi project you want to test.

If your application includes the TwwDBGrid from InfoPower, you must also configure support for the grid.

Linking to the MicDelphiAgent.pas Module to Enable Communications

You must perform the following steps for each application that you want to test.

To link to the MicDelphiAgent.pas module:

  1. Add the <QuickTest Professional Installation folder>\dat\Extensibility\Delphi folder to your Delphi project search path or copy the contents of the <QuickTest Professional Installation folder>\dat\Extensibility\Delphi folder to your project folder.
  2. Add MicDelphiAgent to the Uses section of your application’s project file (project.dpr) as shown in the example below:

program flight;

uses

       MicDelphiAgent,
       Forms,
       Windows;

($R*.RES)

begin

       Application.Initialize

       Application.Title :=’Flight Reservation’;

       Application.Run;

end.

Compile your Delphi project.

Without that special build Delphi add-in allows recognizing of GUI objects only. Any attempt of execution referring Delphi objects fails with the following error message: “Unspecified error”.


  • 4 responses to "It does (but it doesn’t)"

  • sjenner
    17th July 2009 at 11:52

    Hi Albert,

    We have QTP 10.0 with the QTP Add-ins installed which performed a capture on our application. At least thats what were seeing in the QTP keyword and expert view. No errors happen during capture, but during playback our delphi developed code/application gives an “access violation error with a string) message and shuts the application down. Note: we have not added MicDelphiAgent.pas

  • Albert Gareev
    17th July 2009 at 14:41

    Hi Sjenner,

    Thanks for your feedback.

    Yes, QTP can recognize and capture Delphi controls that have Windows Handle (there are graphic ones that don’t have it).
    That means you can explore your AUT with Object Spy or do recording.

    And – No – QTP cannot communicate with Delphi until Delphi Communication Agent is not enabled. So the script won’t work.

    If your application is in-house developed you can easily make a build for QTP, or even enhance it’s “friendliness” for QTP using Delphi Extensibility Kit.
    Look for more info on: “Start Menu\Programs\QuickTest Professional\Extensibility\Documentation\” – of course, assuming QTP is installed on this machine.

    In my case, the application is vendor-based, so the process of getting the special build is long and painful.

    Thanks.

  • sjenner
    26th August 2009 at 11:59

    Hi Albert,

    Update – we have an interesting occurance – with or wihtout the micdelphi addin, where the capture works but during playback our application throws an access violation error. Also important to clarify delphi 2006 versus delpi 6…2006 is not an HP listed supported version and 6 is…

  • Colin
    18th February 2011 at 7:03

    Hi all, i have tried creating the XML and defining the Delphi objects and changing its native class; and even tried the map code on the extensibiliy in the documentation; however at the end im still losing :-( i need help!

    [ Albert’s reply. Hi Colin, you’re not gonna win unless you make the Delphi application QTP friendly by modifying its source code. Or go with TestComplete instead. ]

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.