Action Template is a mechanism in QTP that allows you to include some text in your new actions by default. The text will be included automatically every time you create a new action. Suppose that for every action you create for your automation suite, you want to include some comments at the beginning of the action. Instead of manually adding it for every action, you can create an Action Template that would automatically add the static text for you. Let us suppose that you want to add the following text in your action –
'=========================================================================
'Action Name -
'Purpose -
'Created by -
'Date -
'Change History
'- - - - - - - - - - - - - -
'Date Changed by Comments
'
'=========================================================================
Let’s see how this can be done –
1. Open notepad and copy the above code to it.
2. Save the notepad as ActionTemplate.mst.
3. Open QTP’s dat folder. For QTP 11, the path can be: C:\Program Files\HP\QuickTest Professional\dat. [Note: The path can change depending upon the OS & QTP version/installation]
4. Add the ActionTemplate.mst file in the dat folder. Thats All !!!
Open QTP and insert a new action. The new action should display the statements that you had saved in the Action Template.
Even after adding ActionTemplate.mst file in dat file, you new Action doesn’t display anything?
Now this is a very common problem faced by many people. And the primary reason for this is the extension of your Action Template file. Many a times when we create an ActionTemplate file using notepad, it gets 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 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
If you enjoyed this article, you can join our blog to get free email updates directly in your inbox.