I have VBScript code which launches QuickTest Professional, executes a series of QTP tests, and emails the results. This works well, but I would prefer to use a language wit
if this still matters to you... QTP 11 allows you to script in C#
Apologies, but I don't have time to convert your full sample over to C#. I've thrown together a simple demo that should get you going. This just uses C# to open a QTP instance:
using System;
using QTObjectModelLib;
namespace QtpDemo
{
class QtpDriver
{
[STAThread]
static void Main(string[] args)
{
Application app = new Application();
app.Launch();
app.Visible = true;
}
}
}
You'll need to compile it linking to C:\Program Files\Mercury Interactive\QuickTest Professional\bin\QTObjectModelLib.dll (which is the .NET interop library for QTObjectModel.dll) and have that and QTObjectModel.dll in your app directory when you run it.
It shouldn't be that hard from here for you to convert any object declarations and function calls from VBScript to C#. Please ask if anything's unclear.
To your other point about samples on the internet - there are plenty of people out there doing more advanced stuff with QTP and QC, but I think any really clever solutions aren't shared. I, for example, would probably be prohibited from sharing such things by my employment contract, but I agree with you - there is a dearth of good QTP API samples out there, at least on Google. Having said that, I heartily recommend the SQA Forums for your QTP and QC needs.
Rich
Please see the following answer as it will give you the exact information you are looking for to connect a C# application with QTP/UFT:
https://stackoverflow.com/a/19887866/2794121
YES, you can use anything that can "do" COM, and that includes C#. Also VB.NET of course.
and Perl, Python, Javascript, and others.
With no help from google, you will have to follow your nose, on how to deal with the interface, but it's not that difficult when you have the existing example. Also your vendor, ideally, will have documented the COM interface for you.