Calendar

May 2007
S M T W T F S
« Apr   Jun »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories

Using External Libraries in QTP

I’ve found it necessary to create my own code libraries in QuickTest Pro to handle scenarios that aren’t generally covered by the typical QTP or VBScript APIs. This is a useful process for creating reusable functions that are accessible to your entire automation suite.

To do this, first create your code library, which will be a VBScript file with your methods, variable definitions, and the like. Then, you need to save this file in a location accessible to your scripts, or the machines that will be executing your scripts. This could be a shared folder on your workstation, a shared network folder, or within QualityCenter.

To access your code library, you will need to execute a statement like this:

ExecuteFile “MyCodeLibrary.vbs”

This code segment will execute the MyCodeLibrary.vbs file, thus loading it into memory. This should be located before any code referencing your library. As it stands, this function will use the absolute or relative path for the file you specify.

Using such a library, you can access classes, methods, functions, enumerated types, etc. For instance, I’ve used this method to access a MySQL helper class I wrote allowing me to directly interface with a test database in my current position.

1 comment to Using External Libraries in QTP

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>