Forum Discussion

didier_cabale's avatar
didier_cabale
Occasional Contributor
12 years ago

invoking tested object methods by script


Hi,

What I want is of the simpliest thing: being able to invoke tested object methods by script.



On my tested application side, I build the following example using Delphi:



type

  TForm1 = class(TForm)

  private

    { Private declarations }

  public

    { Public declarations }

  published

    function GetInteger: Integer;

  end;



var

  Form1: TForm1;



implementation



{$R *.dfm}



{ TForm1 }



function TForm1.GetInteger: Integer;

begin

  result := 1;

end;



end.

//////////////////////////////end delphi project ////////////////////////////////////



on my TestComplete project, I scripted this:



procedure Test;

var

 Form: TForm;

 i: Integer;

begin

 Form := NameMapping.Sys.Process('Project1').VCLObject('Form1');

 i := Form.GetInteger;

end;

//////////////////////////////end script project ////////////////////////////////////



When running the Test procedure, TestComplete stops on "Form.GetInteger", saying "The object with the specified attributes does not exist".

My question is "how to access tested object methods (procedures, functions) ?".

Note:

1. I read this -> http://support.smartbear.com/viewarticle/28188/.

2. I know that published properties are accessible


5 Replies


  • Hi Team,


     


    Didier, TestComplete provides a special utility that allows you to create release builds with external debug information - StripTDS. Refer to this article for more information.


     


    Simon, we have an appropriate suggestion in our DB - I've added your vote to it. Thanks.


     

  • didier_cabale's avatar
    didier_cabale
    Occasional Contributor
    Dear Tanya,

    Thank-you for your answer.

    You are right, the answer to my question is here: http://support.smartbear.com/viewarticle/30273/#GetAccess



    But :

    1. my company does not accept to test an application that is not the one that is delivered. Other said: if we deliver a "Release" compile application, we must test this Release compile application, and not a "Debug" application.

    2. it's really a pity that, on a release compile application, we can access published properties, and not published methods.



    I think you cannot help me further, unfortunately, but thank-you for your help.

    Didier
  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Tanya,



    It would be nice to have a visual approach to test scripts in TestComplete. What I mean is instead of having an object or name mapping path to objects why not make a screenshot of something and then on playback click on it.

    The object.TextObject("string").Click is fine for lists, grids and trees but are there any plan on extending that feature to the whole screen ? Something like Sikuli.



    Sincerely