Sunteți pe pagina 1din 4

Adding Comments ~ QTP Training

http://www.gcreddy.com/2010/04/adding-comments.html

QTP Training
C, SQL, Manual Testing, QTP & VBScript, Quality Center and LoadRunner by G C Reddy (gcreddy@gcreddy.com)
HOME QTP MANUAL TESTING LOADRUNNER QTP ONLINE TRAINING C PROGRAMMING SQL FORUM

2012 Survey Data Reveals:


The Mainframe is Poised to Fuel Future Business Growth. Learn More!
2012_Survey.bmc.com
Subscribe to G C Reddy QTP Group Email: Visit this group

Adding Comments
11:50 AM G.C. REDDY NO COMMENTS

Adding Comments to Scripts


Comments are statements that are ignored by the script host when the script runs. To ensure that the script host does not attempt to interpret a comment as a command, we must preface each comment with a comment delimiter. VBScript allows two delimiters: the single quotation mark (') and the REM statement. For example, both of the following lines of code are valid comments: ' This is a comment using a single quote delimiter. REM This is a comment using the REM statement as a delimiter.

Although most script writers use the single quotation mark, you might consider following the single quotation mark with an asterisk when commenting your code: '* This is another comment. This approach has two advantages over the single quotation mark alone. First, it makes the comment stand out from the rest of the text; a single quotation mark by itself can be difficult to see at times. Second, the single quotation mark is a valid VBScript character that has uses beyond delimiting comments. This can be a problem if we use an automated procedure to extract comments from a script; such a procedure might also retrieve items that are not comments. Because we are less likely to use '* anywhere else in our script, it makes a good delimiter. Always include comments on separate lines except for comments that accompany the declaration of a variable. Comments included on the same line as a VBScript statement (end-of-the-line comments) are valid but can be difficult to read. For example, compare the two commenting styles in the following script snippet; in the first half of the script, comments are placed on the same line as a VBScript statement, while in the second half of the script, the comments are placed on separate lines. Most people find it easier to quickly identify the comments used in the second half of the script. SQL Server Guide VBScript for QTP QTP Guide QTP Online Training QTP Training in Hyderabad Manual Testing Manual Interview Questions ISTQB Certification IEEE Test Documents Software Testing Dictionary

1 of 4

03-12-2012 20:29

Adding Comments ~ QTP Training

http://www.gcreddy.com/2010/04/adding-comments.html

----------------------------------------------On Error Resume Next

Quality Center QTP Videos

Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.MapNetworkDrive "Z:", "\\RemoteServer\Public" '* Map drive Z. If Err.Number <> 0 Then '* Check to make sure the operation succeeded. Err.Clear Wscript.Echo "The drive could not be mapped." End If '* Map drive Z.

QTP Scripting QTP Framework QTP FAQ QTP Certification

Ads by Google

QTP Testing QTP Training How to Use QTP ABOUT ME

WshNetwork.MapNetworkDrive "Z:", "\\RemoteServer\Public" '* Check to make sure the operation succeeded. If Err.Number <> 0 Then Err.Clear Wscript.Echo "The drive could not be mapped."

G . C. RE DDY

I am Gedi Chandra Mohan Reddy, Working as a Test Consultant in Hyderabad, INDIA.

V I EW M Y CO M P LETE PRO FI LE End If ----------------------------------------------Code Commenting Conventions All procedures should begin with a brief comment describing what they do. This description should not describe the implementation details (how it does it) because these often change over time, resulting in unnecessary comment maintenance work, or worse, erroneous comments. The code itself and any necessary inline comments describe the implementation. Arguments passed to a procedure should be described when their purpose is not obvious and when the procedure expects the arguments to be in a specific range. Return values for functions and variables that are changed by a procedure, especially through reference arguments, should also be described at the beginning of each procedure. Procedure header comments should include the following section headings. Section Heading: Comment Contents: Purpose: Assumptions: Remember the following points: QTP Guide Every important variable declaration should include an inline comment describing the use of the variable being declared. 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,
Ads by Google

Script VBS Wscript JS Java Script BLOG ARCHIVE

2 of 4

03-12-2012 20:29

Adding Comments ~ QTP Training

http://www.gcreddy.com/2010/04/adding-comments.html

enumerating objects, procedures, algorithms, dialog boxes, and other system dependencies. Sometimes a piece of pseudocode describing the algorithm can be helpful.

2012 (190) 2011 (67)

Posted in:

2010 (164) December (11)


Recommend this on Google

October (49)
Newer Post Home Older Post

April (56) Selenium Interview Questions

0 comments: Post a Comment

VB Script syntax rules and guidelines qtp real-time script example Dynamic Handling of Object Repositories VB Script Properties VB Script Objects Methods QTP Model Resume 5+ years experience VB Script Errors QTP 3+ Years Exp Resume VBScript Coding Conventions

Comment as:

Links to this post


Looping Through Code

Create a Link
VB Script String Functions Constants VB Script Data Types Comments Scripting Languages Vs Programming Languages VB Script for QTP QTP Other Topics Network Administration Automation Object Model Word Scripts File System Operations Recovery Scenarios Virtual Object Configuration Regular Expressions Environment Variables VB Script Functions Reporting Defects Analyzing Test Results & Reporting Database Scripts-II Debugging Tests

3 of 4

03-12-2012 20:29

Adding Comments ~ QTP Training

http://www.gcreddy.com/2010/04/adding-comments.html

VB Script Fundamentals And Features Adding Comments Step Generator Inserting Transaction Points Inserting Output values Inserting Checkpoints Web Scripts-II Data Table Methods Keyword Driven Methodology Object Identification Configuration Test Object Model Recording Tests QTP Commands User Defined Functions An overview on Test Automation QTP Certification VB Script Examples-II QTP Model Resumes QTP Interview Questions QTP Training Programs QTP Framework VB Script for QTP QTP Scripting QTP Guide

March (39) February (3) January (6)

G C REDDY WEBSITES
Software Testing Jobs SQL Projects

...

GCREDDY

Copyright 2011 QTP Training | Powered by Blogger

4 of 4

03-12-2012 20:29

S-ar putea să vă placă și