Ranorex Help Center How can we help you?

Repository Separation

By default each Ranorex Studio project contains one repository file which is automatically used for each newly created recording. You can manage all UI elements of a test suite project in a single repository file, but there are several reasons for having multiple repositories within a test automation project:

  • Testing Different User Interfaces
  • Common Repositories for Common Modules
  • Advanced RanoreXPath Repositories for Complex Identification
  • Multiple Testers Working on the Same Test Automation Project

Testing Different User Interfaces

If your test suite contains, for example test cases for a web application and tests for a user interface of a client application, it might be useful to have two repositories. One is used to manage the UI elements of the web application while the other exclusively stores the elements from the client hosted application. Although you can separate things within one repository using simple folders for grouping, it makes sense to divide it up - especially when working in teams.

Common Repositories for Common Modules

Repositories can (and should) be modularized and reused in the same way recordings and code modules are. For example when you think about a rich client application using main menus, ribbons or toolbars you would create small reusable recordings for clicking on the main menu 'File' | 'Open' | 'Handle the Open File Dialog' | etc. All these reusable modules work with a main menu, a main tool bar or similar, commonly available controls, and should be based on a repository which exclusively represents commonly used controls on the user interface.

Advanced RanoreXPath Expressions

Another reason to build a separate repository could be to store advanced RanoreXPath expressions which should exclusively be used to create new actions manually instead of recording them.

Multiple Testers on the Same Project

As long as you're working alone on a test automation project it's not a problem to work with one single repository. When working in teams and everyone in the team only clicks the 'Record' button to create test automation modules, it is recommended to keep in mind who is responsible for the main repository. Who is allowed to rename objects and to re-structure the repository? The main reason to separate repositories is to avoid accidental damage to repository items which are used by other team members.


Adding a New Repository

Ranorex Studio is able to handle multiple repositories. When performing automated tests on the KeePass application, this could be useful for testing the complex configuration dialog with a separated repository file to keep your repositories simple and structured and to provide for possibility of multiple users working on different repository files.

Add a new repository to your project by clicking the 'Add Repository' button in the Ranorex Studio toolbar. 

Create a new repository file

Create a new repository file


New repository representing the complex options dialog in KeePass

New repository representing the complex options dialog in KeePass


Screencast There is a screencasts that specifically explains why and how to use multiple repositories in a single Ranorex Project. You can find that video here: http://youtu.be/WYlGt-IG5Uo


Note It's crucial to understand that repositories are essential in working with Ranorex and that the basic principle does not depend on the technology used.


Note There are some differences in the way the elements in different technologies are identified so the RanoreXPath is a bit different for different technologies. Once your repository is able to identify the elements in a robust way, it doesn't matter which technology is behind your test cases. Of course, different technologies can be tested and combined within one test automation project in Ranorex Studio.


Using Multiple Repositories in Code Modules

Now your test project contains two repository files. While a recording module can only have one repository assigned, a code module can use multiple repositories.

[TestModule("C5B0C011-274A-4E54-83DB-0CE28DB95509", ModuleType.UserCode, 1)]  
 public class OptionsCodeModule : ITestModule  
 {  
 // Repository object to access UI elements of KeePass Application  
 MyFirstTestProjectRepository repo = MyFirstTestProjectRepository.Instance;  
 // Repository object to access UI elements of KeePass Options Dialog  
 KeePassOptionsRepository OptionsRepo = KeePassOptionsRepository.Instance;  
      
 /// <summary>  
 /// Constructs a new instance.  
 /// </summary>  
 public OptionsCodeModule()  
 {  
 // Do not delete - a parameterless constructor is required!  
 }  
  
 /// <summary>  
 /// Performs the playback of actions in this module.  
 /// </summary>  
 /// <remarks>You should not call this method directly, instead pass the module  
 /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"> method  
 /// that will in turn invoke this method.</see></remarks>  
 void ITestModule.Run()  
 {  
 Mouse.DefaultMoveTime = 300;  
 Keyboard.DefaultKeyPressTime = 100;  
 Delay.SpeedFactor = 1.0;  
   
 // Click the Save-Button in KeePass MainForm  
 repo.KeePass.ButtonSave.Click();  
   
 // Check the option to AutoClear the Clipboard  
 OptionsRepo.FormOptions.TabSecurity.CheckBoxClipboard_auto_clear.Checked = true;  
 }  
 }  



<testmodule("baa60b6c-5dd1-4eb5-bc39-fdfd65775742", moduletype.usercode,="" 1)=""> _  
 Public Class UserCodeModule1   
 Implements ITestModule  
  
        ''' Repository object to access UI elements of KeePass Application  
        Private repo As MyFirstTestProjectRepository = MyFirstTestProjectRepository.Instance  
 '' Repository object to access UI elements of KeePass Options Dialog  
 Private OptionsRepo AS KeePassOptionsRepository = KeePassOptionsRepository.Instance  
          
 ''' <summary>  
 ''' Constructs a new instance.  
 ''' </summary>  
 Public Sub New()  
 ' Do not delete - a parameterless constructor is required!  
 End Sub  
          
        TestRepository repo = TestRepository.Instance;  
  
 ''' <summary>  
 ''' Performs the playback of actions in this module.  
 ''' </summary>  
 ''' <remarks>You should not call this method directly, instead pass the module  
 ''' instance to the <see cref="TestModuleRunner.Run(Of ITestModule)"> method  
 ''' that will in turn invoke this method.</see></remarks>  
 Sub Run() Implements ITestModule.Run  
 Mouse.DefaultMoveTime = 300  
 Keyboard.DefaultKeyPressTime = 100  
 Delay.SpeedFactor = 1.0  
              
            ''' Click the Save-Button in KeePass MainForm  
 repo.KeePass.ButtonSave.Click  
   
 ''' Check the option to AutoClear the Clipboard  
 OptionsRepo.FormOptions.TabSecurity.CheckBoxClipboard_auto_clear.Checked = true  
 End Sub  
  
 End Class