Action Template in QTP in Testing

If we want to add one or more statements in each and every new action in the test, we can create an action template. Suppose, if we always enter some specific name as the author of an action, we can add that comment line to our action template. An action template only applies to the actions created on our system. QTP does not provide any out-of-the-box way to include a piece of text -template- in every new action.  However there is a roundabout way of doing this. We will call it an Action Template.

How to create an action template:

  1. First create a text file containing the comments and other statements that we want to add in our action template. The text file must be in the structure  and format used in the Expert View.

    action-template-content.jpg

  2. Now save that text file as ActionTemplate.mst in the QuickTest Installation Folder> \dat folder. After that whenever new actions are created they will contain the script line from the action template.

    action-template.jpg

    keyword-view-action-template.jpg

Often, when we create an ActionTemplate file using notepad, it is saved as ActionTemplate.mst.txt. To make sure that this doesn't happen, open any folder, go to Tools -> Folder Options -> View (tab) & and deselect the Hide extensions for known file types option. Check the extension of your Action Template file once again. Verify that the file is saved as ActionTemplate.mst only and not ActionTemplate.mst.txt.

         action-template-saved-file.jpg  


Similar Articles