Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 234611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:11:55+00:00 2026-05-11T20:11:55+00:00

I have VBScript code which launches QuickTest Professional, executes a series of QTP tests,

  • 0

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 with better tools support (a good IDE for example). I am currently calling .Net libraries from the launch script, so I was wondering if it was possible to use a language like C# to accomplish the same task. If so, are there any good resources which address this? I could find very little on this topic via Google and there do not seem to be any other questions on SO about this topic.

For clarity, I have included the code for the routine that does the bulk of the work. This does not include the .Net declarations, but failedTestsList and allTestsList are instances of System.ArrayList.

EDIT: All the QTP documentation examples use VBScript, but as you can see, the code is just creating the QTP objects. I would assume these would be callable from another language which supported creation of these objects. It just seems from my Google failures that no one is doing it.

Sub ExecuteQTPTest(name)
    Dim App, resultsPath
    Dim testPath, testResults
    testPath = name
    allTestsList.Add(name)
    Set App = CreateObject("QuickTest.Application")

    App.Launch
    App.Visible = False
    App.Open testPath

    SetQTPTestOptions(App)
    SetQTPRunOptions(App)
    SetQTPWebOptions(App)

    App.Folders.RemoveAll

    Dim qtpTest, qtpResultsOpt
    Set qtpTest = App.Test
    Set qtpResultsOpt = CreateObject("QuickTest.RunResultsOptions")

    resultsPath = testPath & "\RES1"

    qtpResultsOpt.ResultsLocation = resultsPath

    qtpTest.Run qtpResultsOpt ''// Run the test

    testResults = "Test Status: " & qtpTest.LastRunResults.Status & vbCrLf & _
          "Last Error: " & qtpTest.LastRunResults.LastError & vbCrLf & _
          "Detailed Results located at " & qtpTest.LastRunResults.Path & _
               " can be viewed with the QTP Results Viewer Tool " & vbCrLf

    If qtpTest.LastRunResults.Status <> "Passed" Then
        g_testRunPassed = False
        failureCount = failureCount + 1
        failedTestsList.Add(name)
        LogResults testResults, name        
    End If

    qtpTest.Close

    Set qtpResultsOpt = Nothing 
    Set qtpTest = Nothing 

    App.Quit

    Set App = Nothing 
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:11:55+00:00Added an answer on May 11, 2026 at 8:11 pm

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 108k
  • Answers 108k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If it's referenced it should be included automatically. I've deployed… May 11, 2026 at 9:15 pm
  • Editorial Team
    Editorial Team added an answer I'm using the rake approach (as supported by heroku) With… May 11, 2026 at 9:15 pm
  • Editorial Team
    Editorial Team added an answer My friend I beleive you are spot on. Triggers are… May 11, 2026 at 9:15 pm

Related Questions

I have to maintain an application that has a lot of columns that are
I am having the problem that I cannot select a specific XML node which
I'm showing a modal dialog via window.showModalDialog(... which happens in a vbscript function (the
I have a large classic ASP app that I have to maintain, and I
I have a scenario setup where I need to test to see if the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.