Comments in QTP Script

Comments are statements which are ignored by the host when the script is executed. 
To ensure that the comments statements are not interpreted during the script execution, comment delimiter should be used.We have two type of comments delimiters in VBScript.  They are single quotation mark (') and REM statement.


For example, the following are valid comments.
'This is a valid comment.
REM This is a valid comment.


Even though we have two types of comments delimiters supported by VBScript, most of us are using single quotation mark delimiter.We can use some other character along with the single quotation mark delimiter to show the comments separately.


For example, we can consider '* for commenting statements or lines of code.Ex: '* This is a valid comment.The main advantages when using a character along with single quotation mark are: makes the comment to stand out from other text, single quotation mark is difficult to read.


We need to remember the following points when using comment delimiters. Comments can be included along with the lines i.e., at then end of the line which becomes difficult for the user to read. For easy reading we have to make sure that the comments are added just above the line.


For example we can see both type of comments.
MsgBox "Welcome to Software Testing Community Blog!!!" 'Commented on the same line
 'Commented on a  separate line
MsgBox "Welcome to Software Testing Community Blog!!!" 
So, we can easily understand that the second type of commenting is much easier to read.


Code Commenting Conventions:

  • All procedures should begin with the proper comments saying that what they do.
  • We should not explain the implementation of the behavior.Because the implementation may change.So,it'll cause the unnecessary comment maintenance.
  • If necessary we can have inline comments by describing the implementation.
  • Return values of the procedure that are often changed by should be clearly described.
  • Every important variable declaration should be included in inline comments.
  • Variables, controls, and procedures should be named clearly to ensure that inline comments are only needed for complex implementation details.
  • At the beginning of your script, you should include an overview that describes the script, enumerating objects, procedures, algorithms, dialog boxes, and other system dependencies. Sometimes a piece of pseudocode describing the algorithm can be helpful.
  • Procedure header comments should include the following section headings.
              Section Heading:
              Comment Contents:
              Purpose:
              Assumptions:
SHARE

About அமரகோசம்

    Blogger Comment
    Facebook Comment

3 comments:

  1. Very Informative Blog on QTP Script Testing tool really thanks for sharing this awesome blog. Please offer plently of blog in QTP Course that helps all of them. We are highly specialized in QTP Training in Chennai. Thanks again for such a nice blog.

    ReplyDelete
  2. Thanks for providing recent updates regarding the concern, I look forward to read more. z code system discount

    ReplyDelete
  3. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. zcode system discount

    ReplyDelete