Wednesday, May 23, 2012

QTP Action Template

Whenever you open QTP new action you have to type few lines as comments, function call, execute repository etc. Here is the solution to automate it.

Following are the simple points to make it happen.

  • Create a simple text file and place your structured reusable code in the file.
    • e.g.
      '**************************************
      '    Purpose : This test case does the following:
      '        #    TODO describe about this action
      '    Assumptions    : -
      '    Effects : -
      '    Inputs : -
      '    Returns : -
      '    Author : <Author Name>
      '**************************************

      ' Force explicit variable declaration.
      Option Explicit

      ' load function library scripts
      funcCallMe(param1)

      '**************************************************
      ' Purpose: This function to be called for this action.
      '**************************************************
      Function funcCallMe(ByVal arg1)
          'TODO place your code here
      End Function
  •  Save the created text file as "ActionTemplate.mst"(must be the same name, only name recognized by QTP as Action Template) inside the directory "QTP_HOME/dat".
Now, if you will open a new test then the lines from created Template will be included in your Test.

No comments:

Post a Comment