One Testing Center

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center - QC.

QTP - Frameworks

QTP - Frameworks. Record and Play back Framework. Action Driven Framework. Data Driven Framework. Functional Decomposition Framework. Keyword Driven Framework. Hybrid Framework. Test Driven Framework.

QTP - Automation

QTP - Basics. QTP - Intermediate. QTP - Advanced. QTP - Frameworks.

QTP - Training

Friends, Welcome to OneTestingCenter. I am HP Functional Test ExportOne. I am HP Automation Functional Test Certified Professional. I am certified for HP Functional Test 11.x. Happy to share my knowledge.

QTP - Books

QTP - Keyword Driven Framework. QTP Learning Book - Learn By Questions. QTP Learning Book - Made Easy - Part1. QTP Learning Book - Made Easy - Part2. QTP Quality Center.

Recent Post

QTP @ Dictionary Object >> Remove Method

QTP @ Dictionary Object >> Remove Method

QTP @ Dictionary Object >> Remove

0        '##############################################
0        ' Dictionary Object >> Remove
0        '##############################################
0        Print "##############################################"
0        Print " Dictionary Object >> Remove"
0        Print "##############################################"
0        'Remove
0        'Dim a, d   ' Create some variables.
0        Set oDict = CreateObject("Scripting.Dictionary")
0        oDict.Add "Subject", "QuickTestQTP"   ' Add some keys and items.
0        oDict.Add "Teacher", "GAReddy"
0        oDict.Add "Learner1", "SomeBody"
0        oDict.Add "Learner2", "SomeBodyElse"
0        oDict.Remove("Learner2")   ' Remove Learner2 pair.
0         
0        For each ditem in oDict
0                        Print oDict.Item(ditem)
0         Next
 

QTP @ Dictionary Object >> Add Method

QTP @ Dictionary Object >> Add Method


QTP @ Dictionary Object >> Add

0        '##############################################
0        ' Dictionary Object >> Add
0        '##############################################
0        Print "##############################################"
0        Print " Dictionary Object >> Add"
0        Print "##############################################"
0        'Add
0        Dim oDict   ' Create a variable.
0        Set d = CreateObject("Scripting.Dictionary")
0        oDict.Add "Subject", "QuickTestQTP"   ' Add some keys and items.
0        oDict.Add "Teacher", "GAReddy"
0        oDict.Add "Learner", "SomeBody"
0        '####################################

QTP @ Dictionary Object > Creating a Dictionary Object

QTP @ Dictionary Object > Creating a Dictionary Object


QTP @ Creating a Dictionary Object

0        '--- Creating a dictionary object
0        Set oDict = CreateObject("Scripting.Dictionary")
0        '--- Adding items to dictionary
0        oDict.Add "Name", "GAReddy"
0        oDict.Add "Address", "Hyderabad"
0        oDict.Add "Phone", "0123456789"
0        oDict.Add "Demo", "QTP"
0        oDict.Add "Blog", "QuickTestQTP"
0        oDict.Add "BlogURL", "Http://QuickTestQTP.BlogSpot.com/"
0        '--- Looping the Collection
0        For Each vKey In oDict
0        sItem = oDict.Item(vKey)
0        sMsg = sMsg & sItem & vbCrLf
0        Next
0        MsgBox sMsg


QTP @ VBScript > Dictionary Object

 QTP @ VBScript > Dictionary Object

QTP @ Dictionary Object
0        What is Dictionary Object?
0        Dictionary object consists of a collection of  elements called key-item pairs
0        A Dictionary object is similar to an associative array or a typical array.
0        The difference between a dictionary object and an array is that there is a unique key associated with every item of dictionary object.
0        This unique key can help you in calling that item as and whenever required.
0        A key is a unique entry: no two keys within a single Dictionary object can be the same. The item is just a value that goes along with a particular key. You can have as many duplicate items as you want, it’s only the keys that need to be unique

0        Dictionary: Object that stores data key, item pairs.
0        The Dictionary object functions as an associative array; that is, it stores values in key-item pairs.
0        The Dictionary object is similar to a Collection objects
0        You can access each item stored to a Dictionary object by using the For Each ...Next construct

0        Example of Key _ Item Pair values
0                        Police                    GAReddy            
0                        Doctor                  ReddyGA            
0                        Lawyer                GAR


Method or Property
Description
Methods

Add
Adds a new item to the dictionary
Exists
Verifies whether a given key exists in the dictionary
Items
Returns an array with all the values in a dictionary
Keys
Returns an array with all the keys in a dictionary
Remove
Removes the item identified by the specified key
RemoveAll
Removes all the items in the dictionary
Properties

Count
Returns the number of items in a dictionary
Item
Sets and returns an item for the specified key
Key
Changes an item's key

QTP @ VBScript > Array Sorting





QTP @ VBScript > Array Sorting


'********************************************************
' @ Purpose of the script: To sort an array
'********************************************************
Dim arrSortOut(8)
arrSortOut(0)="X"
arrSortOut(1)="Z"
arrSortOut(2)="Y"
arrSortOut(3)="H"
arrSortOut(4)="I "
arrSortOut(5)="A"
arrSortOut(6)="L"
arrSortOut(7)="M"
arrSortOut(8)="R"


' Before Sorting an array
Print "@@@@@@@@@@@@@@@@@@@@@@@"
Print " Before Sorting : The Array elements are "
Print "@@@@@@@@@@@@@@@@@@@@@@@"
For x=0 to 8
Print arrSortOut(x)
Next


' Sorting an array now...
For i = UBound(arrSortOut) - 1 To 0 Step -1
    For j= 0 to i
        If arrSortOut(j)>arrSortOut(j+1) Then
            temp=arrSortOut(j+1)
            arrSortOut(j+1)=arrSortOut(j)
            arrSortOut(j)=temp
        End If
   Next
Next 
' After Sorting an array
Print "@@@@@@@@@@@@@@@@@@@@@@@"
Print " After Sorting out  :The Array elements are "
Print "@@@@@@@@@@@@@@@@@@@@@@@"
For x=0 to 8
Print arrSortOut(x)
Next

GAReddy @ OneTestingCenter @ All Articles