How to include an Action template in a new action automatically?

Updated On Jul 5, 2013 by

This is an article from Naveen Nischal, India. He will discuss a quick but important tip which can potentially save a lot of documentation time.

Say you want to include a piece of text every time you insert a new action. This piece of text can be some VBScript statements or a part of documentation information like date when the test was created, variables that are used by the test, change history to maintain log of all the changes etc. Something like what is shown in image below:

action-template

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 as Action Template.

  1. Go to <dat> folder inside QuickTest Professional installation <UFT installation>\dat folder.  Normally it can be found under C:Program Files\Mercury Interactive\QuickTest Professional\dat for versions of QTP below 11 and under C:Program Files\HP\Unified Functional Testing\dat for UFT 11.0 or above.
  2. Inside <dat> folder create a file by the name ActionTemplate.mst Open it in notepad and include the information you would like to see whenever a new action is created.
  3. Done. Insert a new action in QTP and see it working!

Thanks Naveen. I’m sure our blog readers will like this tip.

Like Naveen, If you also want to share any QTP tips with the QTP community, do let me know through the contact form.

Welcome new readers: Download the Free eBook!

Ankur JainI am Ankur Jain, the owner of LearnQTP and founder of a software organization. This site is run, maintained and updated by me and my team. Feel free to take a look around, you may want to start with What is QTP? 

You can connect with me on my Google+ page. 

Please enter your first name and email address below to instantly download the eBook on Optimizing QTP Scripts. In future, we will make sure you get new tips & tricks on QTP delivered direct to your email box.



Share This:

25 Comments

  1. Shyam

    is there any action template for BTP component? if so how to create that like ActionTemplate.mst

  2. Dheeraj

    Hi Ankur

    I created a mst file with name Automation Summary.mst , kept it in …\dat folder. We did not find any change in QTP new action. Then we changed the name to ActionTemplate.mst and it worked.

    Can you please help me to understand why it is mandatory to keep the name as ActionTemplate.mst or it is just QTP convention.

    Regards
    Dheeraj

  3. vasanth

    Hi friends,
    Open the notepad->Type what ever u want->Go to File in the note pad->Select save as->enter the name with double colon “ActionTemplate”.
    Then u paste dat folder..
    :)

  4. Nilanjan

    Hi,
    I created the file with ActionTemplate.mst in the dat folder as mentioned above , but when i opened the new action , i could not able to see the action template commented in qtp.., pls help me in this regard

    Thanks
    Nilanjan

  5. vagdha

    hi ankur
    am facing problm in saving mt action tempalte in dat folder can u help me?

  6. srinivas

    While saving the file make sure that

    File Name:ActionTemplate.mst
    save as type :All Files

  7. Rajesh

    hi,
    i created the file with Action Template.mst in the dat folder, but when i opened the new action , i could not able to see the action template in qtp.., pls help me in this regard

    Thanks
    Rajesh

  8. swagat

    hi i have done as per the specifications– created ActionTemplate.mst file inside the dat folder,, still i am not able to see my specific piece of code placed inside the ActionTemplate.mst in action..
    I have used “A” and “T” as capital in ActionTemplate.mst.
    I have placed that in C:\\ProgramFiles\HP\QuickTestProfessional\dat folder.

    Please help me out.

  9. sharath

    hi,
    i created an :ActionTemplate.mst ” file but when i open a new action i dont see any text displayed please help me with this………….

    thanks&regards,
    sharath chandra

  10. janani

    When ActionTemplate.mst file is saved in notepad, it is saved as ActionTemplate.mst.txt. So make sure that filename is correctly saved as ActionTemplate.mst.

  11. Smita

    Good article

  12. Raj Yaramala

    Its really cool

  13. Mamatha

    Hi, I want to create new QTP script with multiple actions say 3 actions login, abc, logoff programmatically. Is it possible to do this.
    i could create a script with one default action – Action 1 but not able to Rename the Action programatically and not able to add additional actions into it.
    i want to do it in a VBS/macro. please help me.

    Regards
    Mamatha TR

  14. Kavya

    Hi,

    I created ActionTemplate.mst file in dat folder under C drive. But in QTP, when i click on New Test, i don’t see the default template. Please help me with this. Am i doing anything wrong here?

    Thanks.

  15. suresh

    Hi,

    Thanks for the tip.
    I have created the mst file but when an action is opened i could not see the format which i have used in the file.

  16. koki

    hi i’m sorry ok i created ActionTemplate.mst in note pad. But the text is not displayed when i insert a new action. Please help me .

  17. koki

    encore moi dsl mai ç amarche pas ce truc je vois r1 même si j’ai crée le fichier sous le nom ActionTemplate.mst mai je peux s’avoir s’il il y a d’autres settings à faire au niveau de qtp plz ????

  18. koki

    merci Ankur ,pour la création c’est fait mais il y a pas d’autres “settings” à faire au niveau de QTP car ça marche pas ?! merci d’avance

  19. Ritesh

    Hi Ankur,
    i created ActionTemplate.mst in note pad. But still the text is not displayed when i insert a new action. Please help me regarding this.

  20. Anees

    Hi Ankur,
    Thankyou I am able to create Action Template.mst file.
    and its working fine

    Thanks
    Anees

  21. Ankur

    @anees – Yes, it gets inserted like comments. Check out the image above.

  22. anees

    Hi Ankur, i am unable to create ActionTemplate.mst.actualy in dat folder i created ActionTemplate.mst in note pad .there in that file whether interms of comment i have to give or what plz help me regarding this i am unable to do that

  23. brahma

    hi ankur now iam able to create the ActionTemaplate.mst file so u can ignore my request..

    Thanks,
    brahma

  24. brahma

    hi ankur, iam facing problem with creating the ActionTemplate.mst file. will you help me to create the ActionTemplate.mst file

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>