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 8806341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:06:21+00:00 2026-06-14T02:06:21+00:00

I’ve built many functions for my QTP 10 tests, and many of those functions

  • 0

I’ve built many functions for my QTP 10 tests, and many of those functions rely on other, related functions. I would like to have my functions import any other functions that they require. Currently, I have to go through each of my functions and associate each of their dependencies by hand.

While I’m aware that ExecuteFile "C:\Functions\SampleFunction.vbs" would work, the downside is that QTP is unable to display any of the code it just imported. That means that debugging the code is a nightmare, since QTP will show that yellow debugging pointer on lines that don’t correspond to the code actually being run. Long story short, that approach is a mess.

Is there any other command that will import other .vbs files into QTP during runtime, so I can have the functions import the other functions they require?

  • 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-06-14T02:06:21+00:00Added an answer on June 14, 2026 at 2:06 am

    I found a post by Anish Pillai called “4 Different Ways to Associate Function Libraries to your QTP Scripts”, that has some useful info. (See the original post here: http://www.automationrepository.com/2011/09/associate-function-library-to-qtp-script/ )

    Method #1 is the usual way to associate functions with a test; nothing new there.

    Method #2 Using AOM (Automation Object Model)
    I’ve tried many different variations, but all of them seem to be scripts for launching a specific test from outside of QTP, not for adding a function to a running test.
    Here’s their code in case it proves useful:

    'Open QTP
    Set objQTP = CreateObject("QuickTest.Application")
    objQTP.Launch
    objQTP.Visible = True
    
    'Open a test and associate a function library to the test
    objQTP.Open "C:\Automation\SampleTest", False, False
    Set objLib = objQTP.Test.Settings.Resources.Libraries
    
    'If the library is not already associated with the test case, associate it..
    If objLib.Find("C:\SampleFunctionLibrary.vbs") = -1 Then ' If library is not already added
      objLib.Add "C:\SampleFunctionLibrary.vbs", 1 ' Associate the library to the test case
    End
    

    Method #3 Using ExecuteFile Method
    Has the same downfalls that I brought up in the question. Could be useful, but it’s horrible for debugging within QTP 10.

    Method #4 Using LoadFunctionLibrary Method
    This is the most promising approach. It appears to do exactly what we need it to: load vbscript function libraries while the test is running. The only catch? It appears to be QTP 11+ only. I can’t vouch for this method since I don’t have QTP 11, but it looks like the perfect approach.

    LoadFunctionLibrary "C:\YourFunctionLibrary_1.vbs" 'Associate a single function library
    LoadFunctionLibrary "C:\FuncLib_1.vbs", "C:\FuncLib_2.vbs" 'Associate more than 1 function libraries
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I would like to count the length of a string with PHP. The string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.