Saturday, November 16, 2013

Object Repository in UFT 11.5

Object Repository is second most important component in UFT after addin manager it has extradinary features and it will support developers to perform task easily.

Object Repository:

              Object Repository is a file where we are storing object properties and values so that we can perform actions based on those properties and we can modify those properties according to our test requirement.

How to Open Object Repository in UFT:

Navigations:

1."Resources" menu from menubar----->Object Repository
2.CTRL+R
3.by clicking on Object Repository button as shown in below


Generally object repository is divided into the following two types
  1. Per Action Repository
  2. Shared Object Repository
1.Per Action Repository:


Per action repository means for each action we have one repository by default so A repository file is stored with each action that we created

Per -action repository satisfies the following list of points

1.UFT creates a new blank Object repository for each action,as shown in below



2.As we record operations on objects in our application UFT automatically stores the information about the objects.

3.When we create new action,UFT creates another new Object Repository.

 here I created new action UFT creates action with repository as shown in below

4.If we record same object in two different actions the object is stores as a separate test object in each object repository.

5.Per Action Repository extension is -->.MTR(Module Test Repository )


2.Shared Object Repository:

Shared Object Repository is repository file where we use same file for all actions in our test.The extension we used for Shared Object Repository is (.tsr{Test Shared Repository})

here test Objects are stored into Object repository while we are recording and they will be used for scripting and any other requirement.

Adding Objects to Object Repository:

There are two ways to add Objects in Object Repository

1.Through Recording
        when the tool in normal recording mode what ever the objects that we record those will automatically stores into Object Repository.

2.Pre-learning(Manually Adding):

          In this process we add object by Object selectively or all objects available in the window can be added at a time to repository then we start with scripting.

Navigation:

Resources from menu bar--->Object Repository--->Object--->Add objects to local as shown below

or
Resources from menu bar--->Object Repository--->Add Objects to Local from tool bar


Once we click on Add Objects to local our mouse control becomes hand icon as we get in object spy then click on required object if it is independent test element it will automatically stores in to Object Repository or if the selected object is container like it contains multiple objects we need to click on ok,the scenarios as shown in below


After clicking on OK you will get the below window select the required option

the options behavior is as follows:

1.Selected Object Only:

if we select this then it adds to the object repository the previously selected objects's properties and values without its descendant objects.
****here previously selected object means only login dialog will add with out any objects that are present  inside that login dialog./only Parent

2.Default object Types:

If we select this option it will add the previously selected object and all the functional objects in side that object to the Object Repository.

All objects are stored with their properties and values in OR


3.All object Types:

if we select this one it will store selected object,all functional,non functional objects inside that Object as shown in below

4.selected Object Types:

Here when we select this option the select button will enable and if we click on this we can set preferences which objects we want to select according to that filter,all objects in side selected objects will stored into Object Repository



select the required option click on ok corresponding objects will add to Object repository which will helpful while writing scripts.


Export Object Repository into XML Format:

we can export Object Repositories in the form of XML format.

Navigation:
Resources--->
to be continued in very shortly

Sunday, November 10, 2013

Synchronization In UFT 11.5

"Synchronization" It is a process of matching the speeds of both UFT and application(the app that we are testing ) in order to get proper execution results.

OR 

It is process of matching the tool time and application time in order to complete the script execution successfully with out any interruption.

When Synchronization is Needed ?

when we are running a test using UFT it ideally works with same speed and gives the instructions to the  application with the same speed some times the application may take some time for processing  the specific instruction at that time our UFT won't wait for that time it immediately process the next instruction then we can't get expected result and entire application will fail to test at that time we need to implement some synchronization mechanism for waiting the tool till it gets a response from application

There we use these synchronization feature.

example:
if we are testing an login application of any mail we need to login and click on signout button but the application will take some time for login after clicking on "sign in" so our tool needs to wait for ample amount of time for "signout "button then we will click on sign out so for waiting we use this synchronization concept.

Note:  The generally the application may fast/slow we are synchronizing the tool with app.

UFT provides the following methods /properties

1.Object Synchronization time out( ) or Default synchronization time out

2.Wait Property

3.Wait( )

4.Exist ( )

5.Sync ( ) <------- Only for Web

Note:
The default waiting time of our UFT is 20 sec and if the operation is performed in 1 second it wont wait for remaining 19 seconds it is called "Dynamisam" here we can increase the wait time to as we want.

1.Object Synchronization Time Out:

It is the maximum time provided by UFT by default to execute each statement individually within this time.

The default time is 20 seconds you can find the default time in the following path

File---->Settings---->Run--->Object Synchronization Time out please find the below snap shot



2. Wait Property:

It waits  untill  the specified object property achieves the specified value or exceeds the specified timeout before continuing to the next step.

syntax:

Object.WaitProperty(PropertyName,propertyvalue,[timeout])

Object                 any test object
PropertyName:    the name of the property whose value is checked
Propertyvalue:     The value we are expecting
Timeout               optional time in milliseconds

Note:
It is for object level and synchronization time out is for Application level

example:

Flight reservation login app for this scenario

Adding login,flight reservation objects to OR


Find the complete code from below snap


here we are looking for Window named Flight reservation after clicking on Login button our UFT waits till the enabled property "true"/it will waits for till the timeout is completed UFT will execute next statement if any of the condition is true.

***Note:
The above two mechanisms are dynamic (i.e) they won't wait unnecessary time if the action completes even if we specify long time.

We can perform this kind of synchronization in recording modes also.

3.Wait( ) :-

In this method, without specifying the condition we can keep our tool in waiting state for specified amount of time.

Syntax:

Wait( time in seconds)
ex:

Wait(30)

Note:  It is fully static it will wait full amount of time even the action performed in short time than specified.

4.Exist ( ) :

It is used to check the existence of the application/objects  within the specified time.If the object is available within the time then it returns true otherwise it returns false.This method also dynamic if we get the required thing is less time than specified it will go to next statement.

syntax:

Object.exist(seconds)

5.Sync( ):<----------For web apps only

It waits for the browser to complete the current navigation

syntax:

Object.Sync

Notes:
1.For web apps default time wait is 60 seconds and for windows it is 20 seconds only.


2.If there is any conflict in UFT tool default settings time and explicit settings like  Exist( ),Wait( ), WaitProperty  high priority will be there for external settings only.

3.If we are not specified as external it will take internal settings and perform the operations.

This is sign off of Synchronization Concepts If you need any information on these examples please reach out me I can able to help on them. 

Thursday, November 7, 2013

WIll be continued from thursday

Hey guys the thing you know I have release in NOV15th and code freez is done on this friday I didnt got sufficient time to update my blog over the last week once i become free then i will complete the following concepts completely within a short span of one week

Recordings
Object model -Object repositories
synchronization

all the topics will be covered relavent to the above topics with screen shots and explanation & blog will make a sensible order as well

Sorry for the delay