How To Use Comments in QTP,UFT,VBScript

Spread the love
  • 12
  • 14
  • 12
  • 14
  • 12

How To Use Comments in QTP,UFT,VBSCript
How To Use Comments in QTP, UFT, VBScript

image credit

How To Use Comments in QTP, UFT, VBScript

Comments are an integral part of code development in automation framework. So as the Documentation. Comments enable us to create proper documentation in the script. Adding good comments to your code is only one aspect of writing readable and maintainable code.

Good code is always self-explanatory and self-documenting. A comment generally answers the following questions:

  • Programmer’s intention for writing the code.
  • The actual purpose of the script.
  • With respect to the overall scheme of the script, where does this piece of code stand?

Documentation via comments helps many ways:

  • It helps new developers or reviewer to understand the code easily.
  • It helps the existing developers to understand the purpose of the code, who wrote it, what are the arguments, What are the revision history, what are the prerequisite, etc.
  • Comments can make scripts more understandable, more readable.
  • Comments also make debugging easy.

Good comments are generally paragraph-level comments. Few features of a good comment-

  • No line by line commenting. The code should be clean enough to make the reader understand.
  • A comment should clearly and quickly convey the purpose of the code.
  • A comment should stand for the guideline of the code.

Bad comments are those comments which are redundant. They add more clutter in understanding. As a result, they actually do more harm than good.

We can make some code to run and commented code remains un-executed. If you are using static testing, this feature is your friend.

Hence it is always better to provide comment in our script and this section talks a lot about our code.

Comment syntax is not exactly an operator or a variable but works as an ignore line or lines operator in UFT or QTP or VbScript.

WSH or VBScript engine ignores the comment statements during script execution.

Syntax of a Comment in UFT, QTP, VBScript:

This section displays details on

  • how to add comments in VBScript?
  • how to add comments in UFT?
  • how to add comments in QTP?
Rem Statement

Rem statement (After the Rem keyword, space is required before comment.) can be used to comment a line.

It can be given at the beginning of the line like-

Rem to get values from FlyCombo


It can be given after a valid line. like

Windows("xyz").FlyCombo("abc").getValue() Rem to get values from FlyCombo

how to comment in VBS file?

Apostrophe or single quote is treated as a comment (‘).


Once the WSH gets the single quote, it ignores the line.

Other Usage of Comments

We can create Template of Script, or function or methods or class using proper comments.

'Script Name: MyScript.vbs
'Author: Mr X and
'Created on:29-Mar-2017
'Description: This script will do so and so operations
'       Rev-2: Animesh did change so and so variable
'       Rev-1: Mr X and created the initial script
'initialization section
'Main body
'procedure section
'teardown section

Comment/Uncomment a block of statements

  • Select the block of statement and use the short cut key Ctrl + M (for comment)
  • Select comment block and use short cut key Ctrl + Shift + M (for uncomment)

Purpose of comments in VBScript or UFT or QTP:

  1. We can use comments for making the script understandable hence comments provide code clarity.
  2. We can use comments for making one or more statements disable from execution.
  3. Indent code along with comments make the code readable later.
  4. Using comment we can use white space effectively.
  5. Organize code into logical blocks distinguished by logical comments.

Note: As the English proverb goes too much of good things is never good. It holds good for comment as well. We need to use comment in such a manner that it should short, understandable, comprehensive and to the point.

Otherwise, the purpose of using comment goes down. The code will become to many junk statement with less Value-added code.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 12
  • 14
  • 12
  • 14
  • 12


  1. He ogles these with intense fascination as if mesmerised by them.
    Do not permit owner sweet talk you into buying a dress essentially can’t have.
    The secret to mastering the unknown is not really a secret.

  2. An initiative used by companies within financial world to optimize the speed at which transactions
    are processed. This particular performed by information that
    electronically entered to be transferred from party to another in the settlement process without manually re-entering identical pieces of data repeatedly over the entire sequence of shows.

    As nonetheless got questioning if Leo Trader Pro is right for you and your family?
    If so then don’t be worried about. You can get an copy of LeoTraderPro and attempt it for as
    long as 60 days risk 100 percent free. You have a full 60 days to test Leo Worker.
    If you are not completely satisfied then may do get a satisfied refund of the purchase the price tag.

    Imagine you were getting in for surgery and a chiropractor walked
    in and said, “I saw this ad yesterday, paid $200 in this cool program on how you can do surgery, and look at me now, I am going to make $3,000 disposing of your appendix.” How many
    surgeries will this doctor perform? Right! None. Granted,
    are generally not going over a life or death situation, but the concept will be the same.
    One small mistake could have dramatic effects on your future financial

    Did you remember the first time you crafted a profit typically the stock
    field? Did you remember how it felt when the figures turned
    green inside your live22 free credit for that very occasion? You were elated,
    weren’t one? You wanted more profits, didn’t your organization? However, did you remember how a growing number of uncertain you became considering that the profits grew higher and?
    Did you ask yourself if they should continue
    to retain on and bet for greater profits merely get out while
    the going is good? Did it come a point where your fear
    of losing that profit totally consumed any satisfaction is based
    on have more possible profits? What did you do then?

    Trading almost all about managing your account and minimizing the potential of
    injury. You are out to protect your capital first advertise profits sec.
    So you can’t leave trading considerably a component of software, without
    keeping an eye on on your account. Think of because an play with it.
    Constantly monitor what is occurring. If you can’t stand what is
    occurring then the to stop, or customise the results.

    This leads me any couple of more points. Never put 100%
    faith inside new firm you wish to deal who have. It can be our nature to get impatient and require immediate overall results.
    The right solution to start in order to use use their alerts, enter their suggestions in a demo account,
    and monitor their signals to ensure they make consistent

    This market is the largest in the world. Trillions of dollars are traded
    just about every. Thousands of consumers
    are turning into the Forex as a means to make a living from
    their own home. It’s becoming because the the right home based business.

    Now additional fruits and vegetables be in order to open a demo trading
    account at an online broker agent. This is a great opportunity to use the theoretical knowledge that you just have gained under practical circumstances.

    It is all totally the just like with a real trade, although you may not be trading with real cash.
    Trade like this for several weeks. Soon you will gain more confidence you have to to make regular revenue may.
    As a currency trading beginner, you have never start working on live trading before should trade profitably on the demo scenario.

    • Thanks for dropping by. This is a custom made template. Basically you can download your favorite theme from theme forest and then give full width.

      Please let me know if you need any other help.

  3. Although Fear of Failure and Concern with Success may seem as
    though ought to be, somehow, opposite states of being,
    what underlies them both is the mutual understanding of.

    A person’s self image depends exactly how to he sees himself.
    Initially ask yourself, whether you are a good,
    reliable, honest, friendly or hardworking person. Your working atmosphere also concerns a lot in building your self respect.
    With a low self esteem, negative thinking often pops into
    your mind, thereby grounding anyone to accept the criticisms that others kind of you.

    This eventually leads you to get your self assurance and self motivation.

    When when using the positivity sandwich, the ACT with Tact approach
    in a position to helpful. ACT is an acronym for Appreciate, Correct (or Communicate), and Thanks for your time.
    In the book by Linda Kavelin Popov, “A Pace of Grace”, she writes for your ACT
    with Tact means for giving feedback about sensitive situations.
    Here’s an position.

    What then, about be anxious? I wanted to identify. If we move into the fear and meet it eye
    to eye what happens if fear meets us there? “So,” I asked
    Tom: “are you afraid?

    When it will come to self confidence, it is something that will benefit you in additional than method. Why? Because greater self confident youa re, the effortless will wish to talk to you, along with the easier it is to in order to them. See, this may help you when it comes to approaching women as well.

    This applies for rather a lot of aspects. No doubt finish product end up being good to sustain your market market, nevertheless the presentation is every bit as important with the current economic fast paced life where no one is going to sneak into until they see the outlook as fabulous. You obtain a associated with happy birthday greeting cards but you open the charming ones first. This particular is the generally accepted phenomenon in case you are wearing good clothes people will have a good opinion about you until and unless you notoriously notorious.

    This change of heart was hard acknowledge. I could not heed the interior signals that have telling me to stop because among the louder voice cautioning we had started something we needed conduct. Others were depending on others. Listening to the small “Stop” voice was dangerous, because I’d disappoint everyday people. It was easier to plow ahead, even the hho booster meant discounting my nuggets of information.

    As absolutely see, you will find things can be performed after created a mistake. Take advantage of the personalization you can do when you are a small business and think of this as a possibility to show your customer how versatile and valuable your merchandise can be.

  4. Hi! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?
    My weblog looks weird when browsing from my iphone 4.
    I’m trying to find a template or plugin that might be able to correct this issue.
    If you have any recommendations, please share. Cheers!

  5. Thanks for sharing your thoughts. I really appreciate
    your efforts and I will be waiting for your further write ups
    thanks once again.

  6. My brother recommended I might like this web site. He was once totally right.

    This put up actually made my day. You can not consider just
    how so much time I had spent for this information! Thanks!

  7. What’s up to all, how is all, I think every one is getting more from this website, and
    your views are nice for new people.

  8. You really make it seem really easy with your presentation but I
    to find this topic to be really something which I think I’d by no means understand.

    It sort of feels too complex and very extensive for me.
    I am having a look ahead on your subsequent publish,
    I will try to get the hold of it!

  9. I’ll right away grasp your rss feed as I can’t in finding your e-mail subscription hyperlink or newsletter
    service. Do you’ve any? Please permit me understand in order that I may subscribe.

  10. I’m not that much of a online reader to be honest but your blogs really nice, keep it up!
    I’ll go ahead and bookmark your website to come back in the future.
    Many thanks

  11. With havin so much written content do you
    ever run into any issues of plagorism or copyright violation? My
    website has a lot of exclusive content I’ve
    either authored myself or outsourced but it appears a lot of it is popping it up all over the internet without my
    authorization. Do you know any techniques to help prevent content from being ripped off?
    I’d certainly appreciate it.

    • Hello, Yes I do face sometimes with the code. Most of the time I try to reproduce the code on my machine. Changing the variable names helps. I generally give reference to the original author or Original post.

  12. Someone necessarily help to make critically articles I might state.

    That is the first time I frequented your website page and thus far?
    I surprised with the analysis you made to create this actual submit incredible.
    Excellent job!

  13. Hi there, I wish for to subscribe for this weblog to take most up-to-date updates, thus where can i do
    it please help out.

  14. Hi, I do think this is a great web site. I stumbled upon it
    😉 I will come back once again since I book-marked
    it. Money and freedom is the best way to change, may you be rich and continue to help others.

  15. Its not my first time to pay a visit this website, i am browsing this web
    page dailly and take fastidious information from here all the

  16. What’s up it’s me, I am also visiting this web page regularly, this
    web site is really nice and the users are actually sharing
    good thoughts.

  17. A motivating discussion is worth comment. There’s no doubt that that you should publish more
    about this topic, it may not be a taboo matter but usually folks don’t talk about such subjects.
    To the next! All the best!!

  18. Thank you for the good writeup. It in fact was a amusement account it.
    Look advanced to more added agreeable from you! However, how can we communicate?

  19. Hi it’s me, I am also visiting this website regularly, this website is in fact fastidious
    and the users are genuinely sharing good thoughts.

  20. These are genuinely fantastic ideas in regarding blogging.
    You have touched some pleasant points here. Any way
    keep up wrinting.

  21. I’m impressed, I must say. Seldom do I come across a blog that’s equally educative and interesting, and let me
    tell you, you have hit the nail on the head. The issue
    is an issue that not enough men and women are speaking intelligently about.
    Now i’m very happy I came across this in my search for something relating to this.

  22. Pretty great post. I just stumbled upon your blog and wished to say that I’ve truly loved surfing
    around your weblog posts. After all I will be subscribing on your rss feed and I am hoping you write again soon!

  23. It is perfect time to make a few plans for the long run and it is time to be happy.
    I’ve read this publish and if I may I desire to suggest you some attention-grabbing issues or suggestions.
    Perhaps you can write subsequent articles regarding this article.

    I desire to learn more issues approximately it!

  24. I appreciate, lead to I discovered just what I used to
    be having a look for. You have ended my 4 day lengthy hunt!
    God Bless you man. Have a great day. Bye

  25. I am genuinely thankful to the holder of this web page who has shared this enormous piece of writing
    at at this time.

  26. Hi! I understand this is kind of off-topic however I needed to ask.
    Does operating a well-established website like yours require a massive amount work?
    I am completely new to operating a blog but I do write in my diary every day.
    I’d like to start a blog so I will be able to share my personal
    experience and feelings online. Please let me know if you have any kind of recommendations or tips for new aspiring bloggers.
    Appreciate it!

    • Thank you Progynova . Your comment will help us to write more good content and information.
      Coming back to your comment, I read lots of books and write the summary, which I feel people need to know.

  27. What’s up, yes this piece of writing is really fastidious and I have learned lot of things from it
    on the topic of blogging. thanks.

  28. Hi friends, its enormous piece of writing about educationand completely defined, keep it up all
    the time.

  29. You made some good points there. I checked on the web for additional information about the issue and found most
    people will go along with your views on this site.

  30. you are in point of fact a just right webmaster.
    The website loading velocity is amazing. It seems that you’re doing any unique trick.

    Furthermore, The contents are masterpiece.
    you have performed a excellent task in this subject!

  31. Howdy outstanding blog! Does running a blog similar to this take a
    great deal of work? I have no expertise in computer programming however I was hoping to start my own blog in the near future.
    Anyhow, should you have any recommendations or techniques for new blog owners please
    share. I know this is off topic but I simply needed to ask.
    Many thanks!

  32. Hi, of course this post is genuinely nice and I have learned lot of things from it on the topic of blogging.

  33. What’s up i am kavin, its my first occasion to commenting anyplace, when i read this post i thought i could also create comment due to this good piece
    of writing.

  34. Fantastic blog! Do you have any tips and hints for aspiring writers?
    I’m planning to start my own website soon but I’m a little lost on everything.
    Would you propose starting with a free platform like WordPress or go for a paid option? There are
    so many choices out there that I’m completely
    overwhelmed .. Any tips? Thanks a lot!

  35. Hi everyone, it’s my first visit at this site, and post
    is in fact fruitful in support of me, keep up posting such articles.


Please enter your comment!
Please enter your name here