English|Deutsch
Subscribe Ranorex Announcements Feed Ranorex LinkedIn Ranorex twitter Ranorex Facebook

Object Repo - Ranorex Spy

This quick start example shows how to create a Ranorex object repository and how to use it in test automation code. The main task of an object repository is to separate identification information (RanoreXPath) from test automation code. Additionally, the object repository could be used to represent a logical view on the application under test.

1. Open Ranorex Spy from your installation folder.

Ranorex Spy Element Browser

2. Now switch  from the 'ELEMENT BROWSER' view to the 'REPOSITORY BROWSER' view.

Open the Calculator application and track those buttons you want to automate by clicking the 'Track' button.

By clicking the 'Track' button the tracking mode is switched on to select one UI element from the calculator application.

The tracked buttons from the calculator application are now listed within the object repository. In addition for each button a logical name is automatically linked to a the RanoreXPath identifier.

3.  Save your repository to use it within a Ranorex test project.

Save object repository
Choose a location for your repository

4. Now open your Calculator test example within Ranorex Studio to use the object repository for test automation.

Add the generated object repository to your project by selecting the context menu item 'Add | Existing Item'.

Add an existing item to your project and ...
... select the object repository currently generated by the Ranorex Spy.

Double click the object repository to see the objects tracked with RanorexSpy. Also open the generated repository source code to ensure code completion within the code editor.

Object repository in Ranorex Studio
Generated code based on the object repository

5. Now switch to  the Program.cs file to write your test automation code based on the object repository.

Create your own method as a container for your object based test automation code.

Use the code completion to simplify access to the repository objects.

6. Call the method "UseMyObjectsForAutomation" instead of the Recorder based automation code.

Calling method within main routine

7. Start your test application


Compile and start your application by clicking the green 'Run' button in the Ranorex Studio toolbar, by pressing the F5 button or selecting the menu item 'Debug | Run'.

Note: This automation code requires an opened calculator application.