Using Subversion with Ranorex projects

Feb 29, 2012 | Best Practices

Using Subversion with Ranorex projects

In general, it’s a good idea to use some kind of revision control system to keep track of the progression of your automated test projects – that way you can revert to a previous version if you run into trouble.

Additionally using such a version control system is almost essential if you are working as a team on the same test automation project.

Therefore we recommend to use a source versioning system like SVN (which integrates in Ranorex Studio), having the advantages of

  • making the history of all changes made to your project visible
  • providing backup functionality
  • preventing security issues on network shares (source code checked out locally)

to name some of them.

The following paragraphs will explain how to

Before starting with the Ranorex specific part of this blog post I would recommend to have a look at the book Version Control with Subversion to get a complete overview about version control (and learn things such as how to set up a SVN server).

Setting up Ranorex for a better Subversion experience

Before performing all the subversion specific update/commit stuff, you should adjust the subversion settings.

To do so open the Tools Options dialog and check the option “Automatically add new files” in Subversion Options area

Check "Automatically add new files"

and uncheck the option “Automatically copy/move log files to the project reports directory” in Ranorex Log Viewer area.

Uncheck "Automatically copy/move log files to the project reports directory"

In the Subversion Options area at the Tools Options dialog you can also choose the SVN version you are using (1.6 or 1.7).

Checking out a repository to your local drive

Please note that it’s necessary to have access to a SVN-Server and a repository located on this SVN-Server to perform the following steps. Therefore please have a look at the book Version Control with Subversion or contact your system administrator. If you do not want to host your own SVN-Server you can also use a free source code hosting service as listed at this wikipedia article. It’s also possible to create your own repository without the use of a SVN-Server. This can be done using e.g. TortoiseSVN; for a step-by-step description see this blog post.

After making sure that you have  access to the repository for your Ranorex test solutions, first of all you have to check out the repository to a local folder (called “working copy”) on your hard drive to put your solutions into it.

Open the Subversion Checkout dialog…

… and check out your repository to a local directory

Commit a project to your repository

After doing so, generate a new solution into the working copy directory you’ve just made a checkout to.

The generated files have automatically been added to your repository, since you have set the option “Automatically add new files” before.

Project View

To commit the changes to your repository simply right-click on your solution file and choose “Commit…” from the context menu.

Commit changes

Versioning models

The basic problem of sharing files is that changes made by one team member might be accidentally overwritten by another as sketched in following figure:

The modified version File’ of File is overwritten by the modified version File’’

To overcome this issue you can follow two different approaches:

The “Lock-Modify-Unlock”-approach:

Tester2 will not overwrite changes of Tester 1 as the file is locked

The “Copy-Modify-Merge”-approach:

Copy-Modify-Merge-1

Tester1 merges his changes with the changes of Tester2

The “Copy-Modify-Merge” approach is the default used by Subversion. As all checked in files are text based files there should be no problems with using the “Copy-Modify-Merge” method. Even the XML-files should be understandable easily. So, in case of a conflict you should be able to determine which differences to accept or to decline.

Merging Test Suite file

Of course you can also use the Lock-Modify-Unlock model, if you do not want to merge the files manually.

Locking Test Suite file

By following the mentioned steps and looking up unclear topics in the book Version Control with Subversion there should nothing stand in your way using version control with your Ranorex projects.

Related Posts:

How to Use Ranorex Studio in Your BDD Process

How to Use Ranorex Studio in Your BDD Process

The SpecFlow add-in provides file templates for feature files, step definition files and event definition files. It also translates the features from Gherkin syntax to C# code. To install the SpecFlow add-in to Ranorex Studio, follow the instructions below: