How To Use Comments in QTP,UFT,VBScript

38
118
Spread the love
  • 12
  • 14
  • 12
  • 14
  •  
  •  
  •  
  •  
  •  
  •  
    52
    Shares

How To Use Comments in QTP,UFT,VBSCript
How To Use Comments in QTP,UFT,VBSCript
image credit www.atoztoa.com

How To Use Comments in QTP,UFT,VBScript

Comments are integral part of code development in automation framework. So as the Documentation. Comments enable us to create proper documentation in the script. 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 debug easy.

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, a 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
Windows("xyz").FlyCombo("abc").getValue()
 

Or

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 singe quote is treated as comment (‘) .


'Windows("xyz").FlyCombo("abc").getValue()
 

Once the WSH gets the 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 techtravelhub.com
'Created on:29-Mar-2017
'Description: This script will do so and so operations
'History: 
'       Rev-2: Animesh did change so and so variable
'       Rev-1: Mr X and techtravelhub.com created the initial script
'******************************************************
'initialization section
----
----
'Main body
----
----
'procedure section
----
----
'teardown section

Comment/Uncomment a block of statements

  • Select block of statement and use 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
  •  
  •  
  •  
  •  
  •  
  •  
    52
    Shares

38 COMMENTS

  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
    life.

    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
    returns.

    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.
    Thanks.

  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
    time.

  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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here