Forum Discussion

nishantp's avatar
nishantp
Visitor
10 years ago

Runner.CallMethod not working after Runner.Stop(true) in OnStop Event.

Hello,

 

We have a function in which certain conditions are cheked. If those conditions are not met then inside the function then we are calling Runner.Stop(true) so as to stop the execution of script.

 

Once Runner.Stop is called the excution pointer moves to OnStopTest event of TestComplete to perfom the cleanup activity.

Inside OnStopTest events function, we have used Runner.CallMethod("ScriptFileName.FunctionName").

 

It has been observed that the Runner.CallMethod never invokes the called function and the statement is ignored.

This behaviour is observed only if Runner.Stop(true) is called before the execution pointer moves to OnStopTest events function.

If Runner.Stop(true) is not called then Runner.CallMethod("ScriptFileName.FunctionName") present in OnStopTest events function woks fine.

 

Please suggest a solution to the above problem.

 

Thanks,

Nishant

  • This is true.  It is even documented in the Remarks section of the CallMethod page.

     

    You can still call your functions directly using USEUNIT.  So instead of

     

    Runner.CallMethod("Unit1.func");

     

    use

     

    //USEUNIT Unit1

    Unit1.func();