Working with Object Repository

After successfully login into the OpKey Web, select the appropriate Project in which you want to create an Object Repository File.

You will be navigated to the screen as shown below:



You can mark the “Don’t show me again” checkbox as checked if you do not wish to view this notification again.

Click “End Tour” to proceed with the process of creating an Object Repository file.

How to create an Object Repository File?

Method 1

After clicking on “End Tour”, you may "Click to Create New Artifact".Select Object  Repository.

The “Object  Repository”  text will appear highlighted.



Click on the highlighted icon to create a New Object  Repository file. A Create Object  Repository window will get open as shown.



The fields marked with * are mandatory. Enter the Name of the Object  Repository. You can also enter the Description. Click OK.

Method 2

Go to Project Workspace > Select the root Folder > Click Create New file icon  > Select Object Repository.


An Object  Repository file will be created in the Root Folder of the Project Workspace.

You may rename the Object  Repository accordingly.

Method 3

Right click on root folder > select Create New > select ‘Object Repository .

An Object Repository file will be created in the Root Folder of the Project Workspace.

The Object  Repository window will open up as shown :

Select the page (Html Page, Frame or Page) of the web application from where objects are to be fetched along with page area (Base, Button, Checkbox, etc.) corresponding to that page as shown below.

The properties of added objects are shown in the right pane. You can add & delete the object(s) as well. The IsUsed checkbox is used to consider or skip that respective object property during execution. In this way, an Object Repository file has been created which contains few objects.

Save the objects by using Save OR button. You can rename the object with the help of Rename Object button. It also allows you to delete the unwanted object(s) by using the Delete Object button. Refresh button can be used to refresh the whole Object Repository file.

Once Objects are fetched successfully, you can have a look at the complete list of objects along with their properties.


This Intellichoose (middle pane) is used to automatically consider all the object properties during execution whether they are checked or unchecked.

This intellichoose (right pane) is used to consider that all object properties of the particular selected object are used during execution whether they are checked or unchecked.

noteAny enterprise application would have dynamic controls. Hence we have build IntelliChoose™ – A smart object recognition technology. With IntelliChoose, along with object properties, we also capture surrounding objects to enable visual identification of dynamic element. This makes automated tests much more robust and reliable.

IsRegex stands for Regular expression which is used to handle dynamic changes made to the object. For more details about IsRegex, refer: https://opkey.wordpress.com/2013/07/16/how-to-handle-dynamic-objects-with-opkey/

You can rename, delete, copy & paste objects by right click on the particular object.

The copied child node can be pasted only to the parent node.

You can not rename, delete or copy the Root Node as these options are disabled on Right Click.

Name of the Root Node is the name of your Object Repository. (Here Root Node is Smart).

Hierarchy of Nodes is: Root Node > Parent Node > Child Node or Objects


Making a duplicate (copy & paste) & Replica of an OR file - 

You can copy the child & parent node but you can paste or make a replica of the copied parent/child node only within a parent node.

In case of making a duplicate (Copy & Paste) copy, when you copy a test case file that is mapped with an OR file then you are able to paste that test case file at the desired location and it will remain mapped with the original OR file.

9

When you make a replica of a copied test case which is mapped with OR file then all the associated artifacts including that OR are also copied and pasted at the desired location in the form of dependent artifacts. This test case will be an independent test case file and there will be no relation between this test case file and the original OR file.

10


Creating Object Repository through ‘Add to OR’

 

https://youtu.be/fXj0PtPb0-4

Overview 

OpKey offers a pragmatic feature of fetching objects with their properties and then collecting them into object repositories. This exceptional feature is named as “Add to OR”.

This method proves fruitful in case of testing and recording web applications.

Need of “Add to OR” feature in OpKey

Let’s suppose you have recorded few actions of any dynamic application through OpKey. Now, you wish to update its existing OR without repeating the recording process then you can do so in two ways:

  1. By Adding Objects Manually
  2. By “Add to OR” feature

Here, arises the need of “Add to OR” feature to fetch Objects along with their properties without any manual efforts and repetition of the recording process all over again.

It is an alternative way of adding objects in an existing Object Repositories.

Flowchart Explaining the Working of “Add to OR” feature in OpKey

Working of Add to OR in OpKey

  • First of all, create an Object Repository file.

                                              OR

  • Open an existing OR. The OR window will get opened.
  • Click on the Add to OR icon.

  • The “Add to OR” window will open up.
  • The OpKey Smart Recorder will get downloaded.  If it is not installed on your system, then install it.
  • Otherwise, Start the OpKey smart recorder.
  • Select any Browser.

  • Once the browser is opened, enter the desired URL over the browser. Press Control and hover the mouse over the web element you want to fetch. The Object Properties will get fetched.

  • Next, Click on Add Object. The Object will get added to the Object Repository.

 

 

 Getting Familiar with "Add to OR" Buttons :

 

Concept of setting Pivot on an Object

Pivot is used to establish relation between static and dynamic objects. Dynamic Object are the Objects which changes their properties at runtime while properties of static object remains the same.

For Example:

Let there be a static Object Company and a Dynamic Object Contacts. Now, if you want to establish a relation between Company and Contacts then:

You need to fetch the Object Company and set this as Pivot element by selecting the checkbox “Set Pivot” for the Object.

Now, fetch the Object Contacts and select relation as “near” or “in” w.r.t the pivot element Company.

 

In this way, you can set relation among the dynamic and static Objects in OpKey. This technique will help you to record dynamic objects and use them in Test case(s)/ Function Library.

Save the OR.

Congratulations! You have successfully added the objects in the Object Repository.
 

 

Using OR Data

You can use your Object Repository data with your test steps within Test Case or Function Library files.

Create a Test Case or Function Library file and add a Test Step.

Go to the Object Repository tab, browse your Object Repository file, expand it and map with the desired object.


Dynamic Object Repository


https://youtu.be/ZZhImYiyTog

Overview:

OpKey Web allows you to create dynamic objects at runtime. The Dynamic Object is an advanced feature which is very helpful in case you need to create and use multiple objects which have almost similar properties. In such cases, you can use dynamic objects which are used only at runtime.

Why to use Dynamic Objects instead of Object Repository?

Its true that the Test scripts can be executed both with Object Repository (OR) and Dynamic Objects. However, Dynamic Objects have several advantages over OR.

Suppose you need to create an FL to click on a button. First of all, you need to record actions fetch objects, save and  execute them in case you are using OR.

While using Dynamic Objects, you just need to inspect element and provide Xpath as the Dynamic Object Property. The FL will get executed without fetching the required objects.

For More - See Example below:

To add a Dynamic Object, follow the steps given below: 

  • Select any Test Step/Function Library whose  action requires an Object Input Argument.
  • Click on the Object Input Argument tab.
  • Go to Object Type tab and select Dynamic Object Radio Button.
  • Add Property allows you to add any property of the dynamic object.
  • you can add properties like Logical Name, Innertext and tag as dynamic object property in the following two conditions:

    The agent is not synchronized with the database.

    -If the agent is synchronized with the database but you are working on old scripts.

    -You can select any property for which you want to provide value. Suppose you have provided values for properties like Logical Name, Name, Innertext, id, class and tag.

    In this case, OpKey will take the property which has the highest priority as Dynamic Object Property.

    *The priority of the object properties are set internally in OpKey in the following order:

note

In case you click on Object Repository or Output radio button then It will not be reflected in the Test Steps unless and until you select the Desired Object Repository or output.

  • Select any property for which you want to provide value. Click on the Value cell. You can provide either static value or value from Global Variable or Output of a Test Step can be used as an input for this Test Step or input parameter of a function library.
  • Select the desired value and Click OK.
  • The Dynamic object will act as an Object Input Argument for the selected Test Step.
  • You can also create dynamic object at the time of recording.

Example:

Test step 1: OpenBrowser

t1

Test Step 2: For 

t2

t3

“i” is a output variable which will hold the output of Step2 

Test Step 3: StringConcat

t4

This String 2 “i” indicates the  variable whose value changes on every iteration

For the  First iteration the value of i [String 2] is "1"

t5

Out1 is a output variable which will hold the output of Step3 StringConcat

Test Step 4: Click

t6

Test Step 5: Next

The FL will get executed and Click on the highlighted alphabets [in the screenshot below] one by one from A- Z 

12

Explanations:

Since a single value is provided for the Test Step 1, only 1 iteration will be performed for the Test Step 1. So in this case, Test Step 1 will be executed and will open the given URL on the specified browser. Once the execution is completed for Test Step 1, the control moves to Test Step2 which creates a For Loop with an incremental variable i having initial value 1.

Now, Test Step 3 and 4will get executed with the initial value of i=1. The Xpath property for all the alphabets highlighted in the screenshot has almost similar Xpath property. Hence, we have used Dynamic OR feature for this particular scenario. We logically made Xpath (as shown above) in such a way that the Xpath changes with each iteration of for loop. This Dynamic Object containing desired Xpath property is passed as an Object input Argument for Test Steps 3, 4.

Thus, when the FL gets executed for the first time, the first value [A] gets clicked. Then Test Step 6 transfers the control back to Test Step 2 with an incremented value of i=2 for the 2nd Iteration.

The process continues for 25 Iterations till the value of i becomes 25. This is how the Test Case gets executed completely.

When the Test Case is executed, the execution takes place as follows: 

Test step 1: 

Iteration 1: Opens the given URL on the specified browser.

For the Test Step 2, 3, 4, 5

And so on till 25 Iterations are completed.