How to comment a block in QTP 8.2

Showing Answers 1 - 19 of 19 Answers

sreedhar

  • May 9th, 2006
 

there is no way to comment a block in qtpso only the way to comment a block is putting a single apostrophe in front of each line of the block

  Was this answer useful?  Yes

Prasanth

  • May 10th, 2006
 

Thanks for the comment. Can you get me link, where i can get more questions on QTP

  Was this answer useful?  Yes

srinivas potnuru

  • Jun 7th, 2006
 

There is some other way round to comment a block of statements

for example u want to block the following code:

Browser("dfdf").Page("sdf").WebEdit("dfd").set "ssdsds"

Browser("dfdf").Page("sdf").WebList("sdsd").select 2

Browser("dfdf").Page("sdf").WebEdit("ddfdffd").set "sddfdffsdsds"

Solution : 

Keep the entire code in a function declaration as below

Function FunctioName()

Browser("dfdf").Page("sdf").WebEdit("dfd").set "ssdsds"

Browser("dfdf").Page("sdf").WebList("sdsd").select 2

Browser("dfdf").Page("sdf").WebEdit("ddfdffd").set "sddfdffsdsds"

End Function

This is an indirect way of commenting a block of statements.

  Was this answer useful?  Yes

maniz

  • Jun 22nd, 2006
 

Regarding your issue following are the things you can try:

1. ? for commenting out a statement

2. REM for adding comment at the end of code

3. Use the following example to comment out a code block

To comment out a block of code use an If-Then structure, where the expression is 0 or False.

Example:

If False Then

Window("Notepad").WinEditor("Edit").SetCaretPos 0,0

Window("Notepad").WinEditor("Edit").Type "Hello This is a test."

Window("Notepad").WinEditor("Edit").Type micReturn

End If

Note:

QuickTest Professional will still read the lines within the if structure, but it will not execute them. Therefore, any syntax errors in the block will be reported during run time.

Let me know if it works for you.

  Was this answer useful?  Yes

Rashmi Ranjan Parida

  • Mar 29th, 2007
 

Please follow the following steps to comment a block of code in QTP

1. Select the block of code
2. Right click on it and select comment Block

Now it will comment the block of code with single comment line but at a time.

If any query, pls get back to me.

  Was this answer useful?  Yes

anurag

  • May 18th, 2007
 

In QTP 9.2 you can comment block of statements by selecting the statements and right click and comment it.

  Was this answer useful?  Yes

Arun

  • Sep 18th, 2007
 

To Comment a block, select set of lines and press Ctrl + m.

To uncomment set of lines press shift + ctrl + m.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions