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# application.

 

C# application (B)                                                     Python TestComplete script             Application A

push button in application A                 --->               pushButton()                --->                *button gets pushed*

 

Is there an elegant way to do this? Like some kind of Interprocess Communication.

I know that there is a REST API, but because both applications run on the same computer this would not be nice solution.

 

I hope you could understand my plan 😄

 

Greetings

 

Leon

  • 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?

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Leon,

     

    I am not sure that I got your plan with all details, so more detailed use case is appreciated.

    From what I got, scenario looks like self-testing application functionality that is now deprecated (but still exists) in TestComplete in favor of Test Left.

     

    • leonmoto's avatar
      leonmoto
      Occasional Contributor

      AlexKaras 

      Basically, my plan is it to push a button/write in a text field etc. in another application, without doing it manually.

       

      So I need the other application to do, what I want it to do.

       

      Also I don't want to control the push button/write in text field actions via TestComplete, but via a external application.

      So that my external application can basically push a button in another application with TestComplete running in the background (TestComplete as a means to an end).

       

       

      I am sorry, if I can not describe my problem properly. My english skills are just the basics 🙂

       

      Greetings Leon

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        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?