Keyword Driven Creation Function Libraries in QTP

Creating Function Libraries

Creating function libraries involves developing customized functions for the application you want to test. You may want to develop functions to test special application functionality that is not already supplied by the methods in the QuickTest object model. This enables you to create keywords that perform operations that are not normally available for use with a particular test object class. For example, you may need to add a worksheet to an Excel file, or to generate a text file during a run session.

It may also be useful to wrap existing methods and functions together with additional programming to create application-specific functions for testing operations or sequences that are commonly performed in your application. The functions you create will be available either as extra keywords or as replacements for built-in QuickTest keywords during the test creation stage.

By encapsulating much of the complex programming into function libraries, and by making these functions flexible enough to use in many testing scenarios (through the use of function parameters that control the way the functions behave), one or a few automation experts can prepare the keywords that many application testers (who are less technical) can include in multiple tests. This also makes it possible to update testing functionality without having to update all the tests that use the keywords.

You may perform the following tasks when creating a function library for the test automation infrastructure:
  • Determine whether you need to create any user-defined functions or whether you should associate any existing function libraries with your test.
  • Determine which keywords are needed.
  • Develop and document business-level keywords in function libraries using the QuickTest Function Library window. For more information, see Working with User-Defined Functions and Function Libraries and Creating a Function Library.
  • Create the actual functions within the function libraries. You can do this manually, or you can use the Function Definition Generator to generate function definitions and header information. For more information, see Using the Function Definition Generator.
  • Optionally define functions as new or replacement methods for test objects. For more information, see Registering User-Defined Functions as Test Object Methods.
  • Debug the function libraries. For more information, see Debugging a Function Library.

Post a Comment


Close Menu