0 Shares 983 Views 10 Comments

Automation Object Model : TestComplete

Dec 30, 2012
983 Views 10

An ObjeAutomating TestCompletect Model is a structural representation of objects that comprise the implementation of a system or application. Automation enables software packages to expose their unique features to scripting tools and other applications. Usually Automation uses the Component Object Model (COM). A critical aspect of COM is, how client and servers interact. A COM server is any object that provides services to clients; these services are in the form of COM interface implementations like Properties, Methods, Events and their relationships. Which can be called by any client that is able to get a pointer to one of the interfaces on the server object.

TestComplete is also a COM Server and its different methods and properties are exposed by its COM interface which can be accessed by other applications and scripting tools to control it from outside. In this post, we will see how to interact with TestComplete from outside via COM. However there are other ways as well to interact with TestComplete, which we will discuss in another post for TestComplete : Command Line.

The very first step is to Connect to TestComplete COM Server. Connection can be created by calling “CreateObject” function. The “CreateObject” function, creates and returns a reference to a COM object.  It accepts two arguments one mandatory and another optional.

ServerName is the name of application that provides the object or the application which provides Com interface. We can call them as automation servers. TypeName is the type or class of object to be created. RemoteServerName is used to create the object on a remote server. For TestComplete it is ‘TestComplete’ as Servername and ‘TestCompleteApplication’ as TypeName.

This will launch a new instance of TestComplete which will be hidden. To make it visible, assign the value ‘true’ to the ‘Visible’ property.

Integration property returns a reference to the ItcIntegration object (Integration object  for short). It provides access to a subset of higher-level functions specifically engineered to let users perform most typical actions over TestComplete with ease.

This will open the project suite located at the mentioned path. Use one of the following methods of the Integration object to run the test:

  • RunProjectSuite – Initiates the run of the project suite opened in TestComplete.
  • RunProject – Initiates the run of tests provided by the specified project.
  • RunProjectItem – Initiates the run of tests provided by the specified project item.
  • RunProjectTestItem – Initiates the test runs provided by the specified project test item.
  • RunTestByName – Initiates the run of a test having the specified name.

Before calling any of these routines make sure TestComplete is not executing any tests. You can do this, using the IsRunning method. If you call this when TestComplete is running tests, an error will occur. Each of these methods returns after the test run was started or after the tests failed to start. They do not pause the program execution until the test run is over. To wait for the test end, you can check the result of the IsRunning method in a loop. To call a specific routine RunRoutine or RunRoutineEx methods of Integration object can be used.

  • RunRoutineEx – lets you call routines containing parameters.
  • RunRoutine – can call routines or script functions that do not use parameters.

below are some more methods of Integration object which can be used while automating TestComplete:

  • ExportResults – to export the results of the last test run.
  • Stop or Halt – to stop the test that is running in TestComplete.
  • GetLastResultDescription – to check whether the last test run finished successfully.

the vbs code below demonstrates how to automate TestComplete.

References:
SmartBear
Microsoft MSDN

You may be interested

Setting up Web Service Automation Project
Katalon Studio
481 views
Katalon Studio
481 views

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
537 views1
Katalon Studio
537 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

UFT Jenkins Integration
Unified Functional Testing
1642 views
Unified Functional Testing
1642 views

UFT Jenkins Integration

Saket - Oct 03, 2017

In our earlier post, we got to know the easy integration of UFT with GIT. This post focuses on integration of UFT and Jenkins. I have also…

10 Comments

  1. This is really great blog and useful tips…i guess every automation expert would benefit from this blog…great work Saket…keep up the good work.

    Reply
  2. Hi saket,

    But i want to pass the path for Project name also instead of only project name.
    “IntegrationObject.RunRoutine sProjectName, sUnitName, sRoutineName” method doesnot work if we pass project path instead of project name.. is there any other method which accepts so?

    Reply
  3. Hi Shireesha,
    Sorry, if I am not getting your question correctly. by Path for project name – you mean it is stored at different location than the project suite?
    In that case as well, the project is still associated with it and it shows up there in project explorer. write exactly the same name as you see in Project Explorer.

    Reply
  4. Another issue:

    I am trying to pass multiple project routines to IntegrationObject.RunRoutine using excel parameterization. Problem arises where human intervention is required when run time error occurs to click on Test complete pop describing the run time error.

    Can we handle that window also using vb script so that my miltiple project routines run at a time without human intervention?

    Reply
  5. Hi Shireesha,

    You can use the error handling techniques like “on error resume next” to handle the error pop up that arises during run time.

    Reply
  6. In such RunTime erorrs how would i log the result as “Fail due to RUn Time error” in my Result using COM-Integration object?

    Reply

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Name
Email Address
Secure and Spam free...