VB Script is used for HP QTP scripting in order to create Test Scripts. VB Script is a Microsoft language where using for .Net development for Web applications. VB Script is a lightweight language, easy to understand, easy to learn and very easy to prepare QTP Test scripts for QTP framework.
Purpose of VB Script in QTP
1.VB Script coding used in hp QTP Test scripting.
2.VB Script is a Microsoft language.
3.Licensed by a many companies and using for programming Language.
VB Script Data Types
VB Script has only one Data type i.e Variant which is used in vb script.Variant is a type of data type that having different information.Variant used as a Null pointer,Boolean,Byte,Storage purpose..etc
Variable is used as a Array type to store information.We can store different type of data into this variable.Vb Script variable should not exceed 255 characters and must be unique.
VB Script has different variable to declare values or assigned types using Dim,Public,Private statements.
Dim - Used for all functions with in the script like global declarations
Public - Used for all functions or procedures for all the scripts
Private - Used for only for which scripts it has declared.
'Global Variable Declarations Dim k,l,m 'Assign value to K K = Inputype("Please Enter k value") 'Assign value to l l= InputType("Please Enter l value") 'Addition of two integers m=l+k 'Display Addition value m MsgBox(m)
Option Explicit is also a variable to declare variables,if Option Explicit used you should declare variables in Test scripts for all the variables.If used Option Explicit it will provide details if variables are not declare under Dim or Public or Private statements.
VB Script Arrays
Array is a type of storage container which is used to store the particular fixed size of values of a single type.The length for array is established at the time of array is created.Array is starts with number 0 for example below.
a means a,a,a,a a = 1 a= 2 a = 3 a = 4
Two Types of Arrays
In this Static Array we can mention size of the array while declaring the array. For Example
Dim Value Value = 1 Value = 2 Value = 3 Value = 4
In this type of Array we can change the array size at the type of Test script and we can resize the array size in Dynamic Array.
Suppose if we want to resize the specified array we can use ReDim statement to resize the dynamic array size.