Posted by: DOCSERVE | December 19, 2011

QTP Scripting Guidelines for SAP

Naming Conventions

Coding standards are language-specific programming rules that greatly reduce the probability of introducing errors into your applications, regardless of which software development model (iterative, waterfall, extreme programming, and so on) is being used to create that application

Coding conventions are designed to help you write code using Microsoft Visual Basic Script. Coding conventions can include the following:

  • Naming conventions for objects, variables, and procedures
  • Commenting conventions
  • Text formatting and indenting guidelines

The main reason for using a consistent set of coding conventions is to standardize the structure and coding style of a script or set of scripts so that you and others can easily read and understand the code. Using good coding conventions results in clear, precise, and readable source code that is consistent with other language conventions and is intuitive.

All Function 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 Function should be described when their purpose is not obvious and when the Function 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.

Function header comments should include the following section headings. For examples, see the “Formatting Your Code” section that follows.

Section Heading Comment Contents
Purpose What the procedure does (not how).
Assumption List of any external variable, control, or other element whose state affects this procedure.
Effects List of the procedure’s effect on each external variable, control, or other element.
Inputs Explanation of each argument that is not obvious. Each argument should be on a separate line with inline comments.
Return Values Explanation of the value returned.

 Remember the following points:

  • 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, enumerating objects, procedures, algorithms, dialog boxes, and other system dependencies. Sometimes a piece of pseudocode describing the algorithm can be helpful.

QTP Scripting Guidelines for SAP(doc)


Responses

  1. Very well documented. Now it would be very helpful to get some more documents as clearly documented and following the sequence of next things to do. This is the very first document in the category of guidelines can we expect more to come? The flow is very impressive.


Categories