Re-Dim: Handle Exceptions in QTP
Re-Dim: Handle Exceptions in QTP
Re-Dim: Handle Exceptions in QTP
Re- Dim
Option Explicit
Array
db connection
dynamic value
regular expression
variable
GetROProperty
GetTOProperty
SetTOProperty
GetAllROProperties Method
ToString Method
WaitProperty Method
ChildObjects Method
User-Defined Functions
function library
open application
Test Results
import entire Excel file
The ReDim statement is used to size or resize a dynamic array that has already been formally declared by using a Private, Public, or Dim
statement with empty parentheses (without dimension subscripts).
You can use the Re-Dim statement repeatedly to change the number of elements and dimensions in an array.
Option Explicit to avoid incorrectly typing the name of an existing variable or To avoid confusion in code where the scope of the
variable is not clear.
you must explicitly declare all variables using the Dim, Private, Public, or ReDim statements. If you attempt to use an undeclared variab
name, an error occurs.
a. Recovery Scenarios. [1. Triggered Events. , 2. Recovery steps. . 3. Post Recovery Test-Run. ]
b.Using “On Error” statement
Variable is a name assign to a storage area that the program can manipulate. A variable type determines the size and layout of the
variable’s memory.
Local Variable is defined as a type of variable declared within programming block or subroutines. It can only be used inside the
subroutine or code block in which it is declared. The local variable exists until the block of the function is under execution. After that, i
will be destroyed automatically.
A Global Variable in the program is a variable defined outside the subroutine or function. It has a global scope means it holds its value
throughout the lifetime of the program.
returns the current property value of the object in the application during the test run.
returns the value from the test object's description.
changes the property values used to identify an object during the test run.
Returns the collection of properties and current values from the object in the application.
Returns a string that represents the test object.
Retrieve the test object name and type from within a function or keyword.
Waits until the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next
step.
Returns the collection of child objects contained within the object.
A function library is a separate document that contains Visual Basic script. Any text file written in standard VBScript syntax can be used
as a function library.
Access their functions during the run session. Public functions stored in function libraries can be called from any associated test or
component, whereas private functions can be called only from within the same function library.
Enables or disables error-handling.
anywhere in your code, any run-time error that occurs can cause an error message to be displayed and code execution stopped.
to disable error handling if you have previously enabled it using On Error Resume Next
Using this code Eg. Browser(“Core Values”).GetROProperty(“version”) you can extract the Browser
a) Syntax Errors
b) Logical Errors
c) Runtime Errors
Call fnFunction()'.
object.GetAllROProperties
object.ToString
object.WaitProperty (PropertyName, PropertyValue, [TimeOut])
object.ChildObjects ([Description])
local /Per-Action repository is “.mtr” .
Global extension .tsr
Select Resources > Object Repository Manager.
DataTable.Import(FileName)
Datatable.import "D:\Automation\Sales.xls"row = Datatable.getsheet(1).Getrowcount MsgBox row
Datatable.import "D:\Automation\Sales.xls"DataTable.SetCurrentRow(1)
Environment
Environment variables are dynamic in nature, and it can be changed.
Environment variables are those variables that can be used globally in the tests. There are two types of
environment variables
Built-in variables
User-defined variables (Has 2 sub-types)
Internal
External
Array
Dynamic array is possible
Size of array must be set before the use of array
We have to use redim statement before adding extra element
into dynamic array
There is no particular method to release the memory if
particular element is not required
Dictionary
There is no concept of dynamic dictionary
The size of dictionary do not need to be set
To add extra element there is no need to write any
statement. We just use add method
Element which is not required any longer can be
removed from the dictionary
Parameter Local
Scope It is declared inside a function.
Value If it is not initialized, a garbage value is stored
It is created when the function starts execution and lost
Lifetime when the functions terminate.
Data sharing is not possible as data of the local variable
Data sharing can be accessed by only one function.
Parameters passing is required for local variables to access
Parameters the value in other function
When the value of the global variable is modified in one function changes
are visible in the rest of the program.