UFT/QTP – VBScript Tutorial Solved Examples

Find whether the given number is an odd or even number
Dim n
n= inputbox(“enter the number”)
n =cint(n)
if (n mod 2 = 0) Then
print(n & “is even number”)
print(n & “is odd number”)
End If Read More

UFT/QTP – VBScript Tutorial Part -3


A VBScript array is a special type of variable that allows you to store multiple values against a single variable.

Features of Arrays

  • Array in VBScript are Zero-Based.
  • Arrays in VBScript can have a maximum of 60 dimensions.
  • If no value is assigned for an array element it consists of Null value by default.
  • Arrays can not only hold similar kind of data but can have combinations of type of data.

Read More

UFT/QTP – VBScript Tutorial Part -2


VBScript has a full range of operators, including arithmetic operators, comparison operators, concatenation operators, logical operators.

Operator Precedence
When several operations occur in an expression, each part is evaluated and resolved in a predetermined order called operator precedence. You can use parentheses to override the order of precedence and force some parts of an expression to be evaluated before others. Operations within parentheses are always performed before those outside. Within parentheses, however, standard operator precedence is maintained.
When expressions contain operators from more than one category, arithmetic operators are evaluated first, comparison operators are evaluated next, and logical operators are evaluated last. Comparison operators all have equal precedence; that is, they are evaluated in the left-to-right order in which they appear. Arithmetic and logical operators are evaluated in the following order of precedence. Read More

UFT/QTP – VBScript Tutorial Part -1

VBScript stands for Visual Basic Scripting. This Scripting language developed by Microsoft, supported by Internet Explorer. VBScript is the primary scripting language for Quick Test Professional (QTP), which is a test automation tool.

Data Types

VBScript has only one data type called a Variant. A Variant is a special kind of data type that can contain different kinds of information, depending on how it’s used.

Variant data types divided into sub data types according to behavior of data type.  Like – Empty, Null, Boolean, Byte, Integer, Currency, Long, Single, Double, Date, String Object Error. Read More