Search code examples
commentsqtphp-uft

QTP/UFT - Adding comments to code in Editor view


How do I add comments in my code via the Editor view for my Actions? I know this is a simple question, but I haven't been able to figure it out, and this seems almost impossible to Google for.

I've tried some of the standard commenting types, none of which have worked:

  • //
  • /* */
  • #
  • --

I know I can add text to the Description attribute for an Action, but I'd like to be able to comment out specific lines in my code as needed.


Solution

  • Do you mean the expert view where you see the generated code?
    You can use the single quote character for that:

    ' The user needs to be informed that the test is ready to run, so 
    ' he can take appropriate actions before continue or Cancel if needed.
    If MsgBox("The test is ready to start.", VbOKCancel) <> VbOK then
        ExitTest
    End If
    

    Shortcut to comment/uncomment blocks: Ctrl+M and Ctrl+Shift+M