Running UFT AOM code from C# Project
Question ID: 107095
1
0

We have some C# Nunit tests that we’d like to incorporate UFT testing with. We do not want to use LeanFT yet, we are only on UFT 12.02. Is there a way to use AOM code from C# to interact with UFT?

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on September 9, 2016 9:55 pm
281 views
Answers (1)
1
Private answer

HPE has instructions to do this in this [KM article][1] (you need an HPE passport login to access it):
[https://softwaresupport.hpe.com/km/KM916723][2]

You have to have a full UFT installation to use this method. The LeanFT runtime engine can not be started otherwise UFT will not launch. Here's the text of the KM article. I have tried this and it works well.

User is trying to invoke QuickTest Professional (QTP) / Unified Functional Testing (UFT) from within a C#.Net Application. Which libraries
should user reference and where can user find documentation on the supported methods for the objects?
Solution
The Automation Object Model (AOM) can be used in many programming languages. For more information about AOM, see Document ID
KM182249 - ''What is the Automation Object Model (AOM) and how is it used?''

Open and/or create Visual Studio C# project. For example, select Visual C# project console application.
Add Reference to Object Model. Visual Studio development environment support(s) referencing a type library. A type library is a binary file containing the description of the objects, interfaces, and other definitions of an object model.

- Go to Solution Explorer
- Right click on ''References''
- Select ''Add References''
- On ''References'' dialogue box
- Use either of below options:

Via COM section:

Go to ''COM'' section
Locate either of below, which should be pointing to binQTObjectModel.dll:

QuickTest Professional XX.xx Object Library

or

Unified Functional Testing XX.xx Object Library

Via Browse section:

Go to ''Browse'' Section
Click on Browse button
Locate binQTObjectModel.dll
Click ''Add''
Enable/Activate/Select it, then click ''Ok''

(Optional) Include ''QuickTest'' namespace (associated to AOM) via ''using'' statement:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuickTest;
namespace ginitest
{
class Program
{
static void Main(string[] args)
{
}
}
}

Use AOM classes within script. Note: Remember if inclusion of desired namespace was not done, it is required to invoke classes with ''QuickTest.*'' prefix, for example ''QuickTest.Application''

static void Main(string[] args)
{
//Declare the Application object variable
QuickTest.Application qtpApp;
//Create the Application object
qtpApp = new QuickTest.Application();
//Start QuickTest
qtpApp.Launch();
//Make the QuickTest application Visible
qtpApp.Visible = true;
}

[1]: https://softwaresupport.hpe.com/km/KM916723
[2]: https://softwaresupport.hpe.com/km/KM916723

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on September 9, 2016 9:57 pm
0
That's really great! Thanks for the help!
( at September 9, 2016 9:58 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top