Arrays VBScript | Automation Testing QTP/UFT

Arrays VBScript:

Arrays are two types – Static Array & Dynamic Array

ARRAY:

Array is a collection of data with different types of data type.

Syntax:
Where, “ArrayName” is the unique name for the array and “size” is a numeric value that indicates the number of elements in the array dimension within the array.

Example:
It stores 4 values. The array always starts from 0.

Assigning values to the array:

There are two types of arrays: 1. Static Array, 2. Dynamic Array.

Static Array:

It has a specific number of elements. Once assigned, size of a static array can’t be modified at runtime.

Dynamic Array:

Size of a dynamic array can be modified at runtime.

Lower Bound & Upper Bound of Array:

Size of the Array:

Another way to assigning Array:

Syntax:
Example:

REDIM:

It recreates the array and erases all the old data

PRESERVE:

Preserve should be used along with redim. It will retain the old data.

SINGLE DIMENSION ARRAY:

MULTI DIMENSION ARRAY:

Some Examples:

Without Preserve
With Preserve
Redim Preserve with Multi-Dimensional Array
VBScript Series:

VBScript for Automation (QTP/UFT) Testing – Part 1

VBScript for Automation (QTP/UFT) Testing – Part 2

VBScript for Automation (QTP/UFT) Testing – Part 3

VBScript for Automation (QTP/UFT) Testing – Part 4

VBScript for Automation (QTP/UFT) Testing – Part 5

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar

Leave a Comment

API Testing eBook

DOWNLOAD FOR FREE