Search code examples
macroskeyboard-shortcutsqtphp-uft

QTP Macro/keayboard shortcut


Is this possible in QTP 11 to set keyboard shortcut that will run macro - generate comment based on current selection. Example:

Function FnGetString(param1, param2)
    'some body
End Function

If I select name of function, I want to generate commented header (using shortcut) function with filled some parameters

'Function Name: <<selected function>>
'Author: <<current logged in user>>
'Date: <<current date>>
'input:
'    - <<parameter 1>>:
'    - <<parameter 2>>:
'output:
'    - 

Some tips how to do it?


Solution

  • QTP 11 does not have any extensible functionality like this. Test Design Studio (full disclosure, that's my company) has built-in functionality for XML-formatted comments that serve a similar purpose to what you're trying to do with your comment header, but having them in an XML format makes the comments easier to consistently parse for metadata. We use the same formatting as Microsoft Visual Studio.

    Starting with UFT 11.5x HP changed the editor control they use, and I believe it allows you to extend functionality. I tried to find those details, but could not locate a link quickly. That will not help you on QTP 11, but is something you can research further and potentially look forward to when you upgrade to UFT.