UFT Object Identification

Object Identification in UFT

Search operation using Regular Expression object.

Create Regular Express Object
Using New and RegExp keywords we can create Regular Express Object.

Set variable - New RegExp

Example:

'Count how many times the word "UFT" appeard in a text file
Dim objFso, objTextstream, objRegEx, mathces, FileContent
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objTextstream = objFso.OpenTextFile("C:\Users\gcreddy\Desktop\abc.txt")
FileContent = objTextstream.ReadAll

Set objRegEx = New RegExp
objRegEx.Pattern = "UFT"
objRegEx.IgnoreCase = True
objRegEx.Global = True

Set matches = objRegEx.Execute(FileContent)
Msgbox matches.Count
objTextstream.Close
Set objRegEx = Nothing
Set objTextstream = Nothing
Set objFso = Nothing
--------------------------------------------
'Create a Word DocumentDim objWord
Set objWord = CreateObject("Word.Application")
objWord.Visible = True

objWord.Documents.Add
objWord.ActiveDocument.SaveAs "C:\Users\gcreddy\Desktop\xyz.doc"
objWord.Quit
Set objWord = Nothing
---------------------------------------
'Count how many times the word "UFT" appeard in a word documentDim objWord, objDoc, objRegEx, mathces, FileContent
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("C:\Users\gcreddy\Desktop\xyz.doc")
FileContent = objDoc.Content

Set objRegEx = New RegExp
objRegEx.Pattern = "UFT"
objRegEx.IgnoreCase = True
objRegEx.Global = True

Set matches = objRegEx.Execute(FileContent)
Msgbox matches.Count
objWord.Quit
Set objRegEx = Nothing
Set objDoc = Nothing
Set objWord = Nothing
-------------------------------------------------
Object Identification Configuration
This Object Identification Configuration is related to Object Repository based Test design only.

UFT has default configuration for every Environment.

Ex: Activex, Visual Basic, Web etc...

Object Identification Configuration varies from one Environment to another.

> What is Object Identification Configuration?
Configuring objects using some important properties in order to recognize them uniquely.

UFT default configuration based on Industry UI design standards.

> Why Object Identification Configuration?
For every Object 20 to 30 properties information available,  Using that complete information recognizing objects is time taking process, Some objects property values may change dynamically throughout the execution,  in order to solve these two problems UFT uses some important properties information to recognize objects.

> When Object Identification Configuration?
Scenario 1:
If we use Descriptive Programming for Test design - Not Required.

Scenario 2:If we use Object Repository based Test design and developers followed UI design standards - Not Required.
(UFT default configuration is Sufficient)

Scenario 3:
If we use Object Repository based Test design and developers not followed UI design standards-Required.
------------------------------
UFT Object identification Configuration is,

Environment Level (Add in), Ex: Standard Windows

Test Object Class Level, Ex: WinButton

Object Identification Configuration:
Ex: WinButton (Button in Standard Windows Environment

Normal Identification
    Mandatory properties
        text
        native class
    Assistive Properties
        height
        width

Smart Identification (Optional)
    Base filter Properties
        window id
        x
    Optional filter Properties
        y

Ordinal Identifier
    Index (0, 1, 2, 3....)
    Location (1, 2, 3....)
    CreationTime (0, 1, 2, 3...) (Only for browser object)

Normal Identification Process:

During learning (Recording/Add Objects) UFT first reads all mandatory properties at a time, and thinks weather that information is sufficient or not?, to recognize the object uniquely.
If it feels sufficient then it stops learning and stores that information.

Otherwise it goes to Assistive properties and learns properties one by one and thinks weather that information is sufficient or not? to recognize the object uniquely.
If it feels sufficient then it stops learning and stores Mandatory and Assistive properties.

After learning all Mandatory and Assistive properties still it feels that information is not sufficient then it goes to Ordinal identifier and learns Index / Location id.

Smart Identification (Normal identification + Smart identification) Process:
---------------------
---------------------------------------
Button (Normal Identification)
-----------
200 buttons

120 buttons - mandatory properties
 20 buttons - mandatory + assistive properties
 60 buttons - Ordinal Identifier

1 - All mandatory properties at a time
2 - Assistive properties one by one(mandatory + Assistive)
3 - Ordinal Identifier

----------------------------------------
Button (Smart Identification (Normal + Smart identification))
-----------
200 buttons

120 buttons - mandatory properties
 20 buttons - mandatory + assistive properties
 40 buttons - smart Identification (base filter properties)
  8 buttons - smart Identification (base filter + optional filter properties)
-----------
  2 buttons - Ordinal identifier

1 - All mandatory properties at a time
2 - Assistive properties one by one
3- All base filter properties at a time
4- Optional filter properties one by one
5 - Ordinal Identifier
-------------------------------------------------   
200 Buttons

100 buttons -default
100 buttons - default not sufficient
Configure the Object class, this configuration is for all 200 buttons.
-------------------------
200 buttons

199 buttons -default
  1 button - default not sufficient

Configure the Object, this configuration is only for that object.
-------------------------------------------
> We can configure Test object class or particular object.

> We will have different configurations for Same environment.

3 projects are running using UFT, all projects are web only.

We can maintain 3 different configurations for these projects.

1st configure 1st application, generate script and store.

Come back to default configuration.

2nd configure 2nd application, generate script and store.

Come back to default configuration.

3rd configure 3rd application, generate script and store.
-----------------------------
Whenever you want to create an execute tests on 1st application then run 1st application configuration script.
------------------------------------------------

0 comments:

Post a Comment