Forum Discussion

leonmoto's avatar
leonmoto
Occasional Contributor
5 years ago

Calling a TestComplete method from external application

Hello, I have a TestComplete project with a python script, wich is testing an application (Application A).  My plan is it, to call a function out of the TestComplete testing script from another C# ...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi Leon,

     

    A note for your scheme:

    -- TestComplete is essentially Windows application. This means that both TestComplete and Application B must be installed on the same Windows machine.

     

    TestComplete does not provide methods like Click(<objectLocator>), but instead it implements the <object>.Click() architecture. I.e. there is no generic Click() method (for example) that can accept some locator, use this locator to get an object and perform click on it. Instead, you must get an object via the means provided by TestComplete and then call .Click() method provided by this object.

     

    Now as for existing options - 5 of them exist (check help for more details):

    -- Self-tested application;

    -- TestComplete as DCOM server;

    -- Regular script called via command line;

    -- REST API;

    -- TestLeft.

     

    Four first options require a script that searches for the object and clicks it to be implemented in TestComplete and differ only by the way how this script is called - using OLE, DCOM, command line or REST call.

    So, regardless of what option out of four first ones you will choose, you will need to create a required script in TestComplete and call it then via one of the mentioned means.

     

    TestLeft is another product provided by SmartBear and is based on TestExecute (which is runtime engine of TestComplete). But in case of TestLeft, you search for the target object and click it not from TestComplete's script, but directly from C#/VB.Net or Java using the wrappers over corresponding methods of TestComplete. I.e. you don't need to create a script in TestComplete, but instead must implement the same functionality (search for the object and click on the found one) in .Net/Java language. (TestLeft is oriented on unit testing and MSTest/NUnit framework, but I hope that it can be used to create a standalone application as well.)

     

    Considering all the above and the fact that TestLeft requires separate license while still utilizes the functionality of TestExecute, my preference is to use one of the first four options. I.e. to create a set of required (parameterized) action scripts in TestComplete and call then the required script via OLE/DCOM/command-line.

     

    However, I think that it is not a bad idea to examine documentation for TestLeft and maybe you might find it to better suit your needs.

     

    What is the reason of why you don't want to have scripts to be created in TestComplete but prefer a separate standalone application?