How to comment multiple lines in robot framework

2,319 views
Skip to first unread message

Mellamputi Sriram chowdary

unread,
Jun 4, 2019, 12:56:39 AM6/4/19
to robotframework-users
Hi ,

Can any one help how to do multi line comment in Robot framework.

Sounak Saha

unread,
Jun 4, 2019, 1:05:00 AM6/4/19
to ssramc...@gmail.com, robotframework-users

There is no block comment feature. However, there's a subtle little trick you can use to comment out whole blocks. It's not documented to be a multiline comment feature but it can be used like that.

This trick works by knowing that robot will ignore any data in tables that are not one of the four recognized tables: keywords, tests, settings or variables. If you have some other table, anything under it up until the next table will be ignored.

The relevant section of the user guide says this:  

For example:

*** Test Cases *** 
| test 1 
| | log | this is test one

*** comment ***
| test 2
| | log | this is test two

*** Test Cases ***
| test 3
| | log | this is test three

If you run the above test you'll see that only test 1 and test3 are executed. Everything in the "comment" table are ignored.


On Tue, Jun 4, 2019 at 10:26 AM Mellamputi Sriram chowdary <ssramc...@gmail.com> wrote:
Hi ,

Can any one help how to do multi line comment in Robot framework.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/edbf1227-9294-473c-9b76-d8ca5bcabea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Regards
Sounak Saha

Pekka Klärck

unread,
Jun 4, 2019, 2:06:50 AM6/4/19
to Sounak Saha, ssramc...@gmail.com, robotframework-users
Yeah, this trick can be used to comment out larger sections of data and also to embed data to test case files. For commenting out just few lines I'd use thr normal `#`.

Notice also that since RF 3.1 only data in sections with explicit `*** Comments ***` or `*** Comment ***` header is ignored. Earlier any unrecognized header behaved like this making it hard to spot typos.

Sent from my mobile.

Mellamputi Sriram chowdary

unread,
Jun 6, 2019, 5:16:33 AM6/6/19
to robotframework-users
  
    Thanks to all.



On Tuesday, June 4, 2019 at 11:36:50 AM UTC+5:30, Pekka Klärck wrote:
Yeah, this trick can be used to comment out larger sections of data and also to embed data to test case files. For commenting out just few lines I'd use thr normal `#`.

Notice also that since RF 3.1 only data in sections with explicit `*** Comments ***` or `*** Comment ***` header is ignored. Earlier any unrecognized header behaved like this making it hard to spot typos.

Sent from my mobile.

ti 4. kesäk. 2019 klo 8.04 Sounak Saha <soun...@gmail.com> kirjoitti:

There is no block comment feature. However, there's a subtle little trick you can use to comment out whole blocks. It's not documented to be a multiline comment feature but it can be used like that.

This trick works by knowing that robot will ignore any data in tables that are not one of the four recognized tables: keywords, tests, settings or variables. If you have some other table, anything under it up until the next table will be ignored.

The relevant section of the user guide says this:  

For example:

*** Test Cases *** 
| test 1 
| | log | this is test one

*** comment ***
| test 2
| | log | this is test two

*** Test Cases ***
| test 3
| | log | this is test three

If you run the above test you'll see that only test 1 and test3 are executed. Everything in the "comment" table are ignored.


On Tue, Jun 4, 2019 at 10:26 AM Mellamputi Sriram chowdary <ssramc...@gmail.com> wrote:
Hi ,

Can any one help how to do multi line comment in Robot framework.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.


--
Regards
Sounak Saha

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Anu S

unread,
Jun 7, 2019, 12:40:25 AM6/7/19
to robotframework-users
Regarding commenting multiple lines.
*** Comment *** works fine if we put huge piece of code under this section.

For example if I want to comment some 15 lines(inbetween) out of 40 lines  single testcase, other than # line by line 
what to use?
Reply all
Reply to author
Forward
0 new messages