Page 1 of 1

Repository Reorganization

Posted: Mon Jun 24, 2013 3:29 pm
by TDCINick
Hello, I've searched around the forums and user guide, but could not find anything that relates to the topic I'm trying to find information on. Our repository is getting cluttered and I want to reorganize it so that it is clear. I'm wondering if I start moving elements in the repository into different folders will it cause the tests to break? Will Ranorex update the path in each of the modules or does it have to be updated manually?

An example would be

Repo.ChannelSales.Quotes.AddLineItem

to

Repo.ChannelSales.Quotes.LineItems.AddLineItem

Re: Repository Reorganization

Posted: Mon Jun 24, 2013 4:06 pm
by krstcs
It should update automatically.

Behind the scenes Ranorex uses a Globally Unique Identifier (GUID) to internally represent all test objects (repository objects, modules, variables, etc.) so the link in your scripts is actually to the GUID, which doesn't change when you rename the repository object, or even move it to another folder.


*** NOTE: ***
Just be careful with this because if you COPY a module (the .cs and UserCode.cs files) in an attempt to duplicate it for easier manipulation, such as wanting to do the same steps, but to different objects, it will just keep the GUIDs for all the variables instead of creating new ones, so you can get yourself in a mess. It is better to create a new module and copy/paste the STEPS from the first one into the new one. You might have to create the variables again, but this will allow Ranorex to create new GUIDs.

Re: Repository Reorganization

Posted: Mon Jun 24, 2013 8:20 pm
by TDCINick
I didn't realize they were associated to a guid. Thanks for the info. This will make life easier.

Re: Repository Reorganization

Posted: Mon Jun 24, 2013 11:38 pm
by carsonw
In my experience changing repository item names will update everything fine. However, adding / removing or moving between folders will NOT work. I'm not sure about renaming folders.

This is frustrating when trying to organize your repository. If somebody finds differently please let us know because then I'm assuming I'm doing something wrong (though it's pretty simple, I'm not sure how it could be done differently, it simply does not work).

Thanks!

Carson.

Re: Repository Reorganization

Posted: Tue Jun 25, 2013 2:09 pm
by krstcs
The only time I have issues with moving things is when the parent items don't have the same path, or the name is already in use in the same branch, but that is a different (user-based :D) problem...

I have never had an issue with test modules not updating correctly when repository objects are moved or renamed.

Re: Repository Reorganization

Posted: Tue Jun 25, 2013 2:25 pm
by Support Team
Hello Carson,

Could you please describe the issue in more detail?
Is it possible to post an example repository and tell us what do you are trying to do?
Which version of Ranorex are you using?
Thank you!

Regards,
Bernhard

Re: Repository Reorganization

Posted: Tue Jun 25, 2013 3:41 pm
by carsonw
Sure - that's interesting because that has never worked for us in any version so it makes sorting the repository into sub folders very frustrating.

We are using the latest version of Ranorex (4.04 I believe), but it has always been the case.

Here is what I did in the example below. I've attached a before and after screenshot so you can see the issue.

1. I have an application root folder called BankAccountPage
2. Beneath it, I have a simple folder called AccountDetails
3. Beneath AccountDetails I have a SelectionBox Repository Item called SelectBankAccountCurrency
4. I created a new sub folder, also under the BankAccountPage called Testing.
5. I moved the SelectAccountCurrency repository item from the AccountDetails sub folder to the Testing Sub Folder
6. I recompiled - an error was returned because it can no longer find the reference.

If I rename the AccountDetails folder OR if I rename the SelectAccountCurrency repository item it's fine. However if I move the item to a new directory, it no longer works.

This makes reorganizing / restructuring our repositories really tedious because we have to manually go through and change everything.

I've attached a before and after screenshot to explain more clearly and can include a copy of the repository if necessary (that will I probably have to email though).

Thanks!

Carson.

Re: Repository Reorganization

Posted: Wed Jun 26, 2013 5:14 pm
by Support Team
Hello Carson,

Thank you for the screenshot and the detailed description.
The problem is that the code that you have written is not updated automatically.
If you move an item from one folder to another it is no longer possible to access the item using the previous expression.

BankAccountPage and Testing are separate classes in the repository and if you move the item, the member variable will be moved as well.

For example if you move the SelectAccountCurrency item from the BankAccountPage folder to the Testing folder the expression "...Instance.BankAccountPage.SelectAccountCurrencyInfo" will no longer work because the member variable SelectAccountCurrencyInfo is no longer part of the class BankAccountPage.

Please let me know if you need more information or assistance.
Thank you!

Regards,
Bernhard

Re: Repository Reorganization

Posted: Thu Jun 27, 2013 10:52 pm
by carsonw
Ok thanks. Yeah, it's unfortunate because if you have a large repository that you want to organize (i.e. arrange into sub folders) it's kind of a painful process.

I was a bit puzzled because it sounded like the original poster was trying to do the same thing and the implication was that it would work (I was hoping the same).

Anyway, thanks for the info!

Carson.

Re: Repository Reorganization

Posted: Thu Aug 08, 2013 10:35 am
by Support Team
Anyone following this post might be interested to know,

As of Ranorex version 4.1.0 it is possible to reorder folders and the user code references will be updated (renamed accordingly). So, that means if you have a Repository with MyAppFolder.MyRootedFolder.MySimpleFoler.SomeButton and you move SomeButton to MyAppFolder.MyRootedFolder all code references to MyRootedFolder.MySimpleFoler.SomeButton will be renamed to MyAppFolder.MyRootedFolder.SomeButton. However, there is one limitation. If you have a variable reference to MyAppFolder.MyRootedFolder.MySimpleFoler and you have a code reference to SomeButton through the variable the code cannot be updated automatically.

This code snippet illustrates the point. In the code snippet the reference to SomeButton (SomeButton code reference #3) cannot be updated.

Code: Select all

        public void Mouse_Click_SomeButton()
        {
        	//SomeButton code reference #1
            repo.MyAppFolder.MyRootedFolder.MySimpleFolder.SomeButton.Click();
            
            var myRootedFolderRef = repo.MyAppFolder.MyRootedFolder;
            //SomeButton code reference #2
            myRootedFolderRef.MySimpleFolder.SomeButton.Click();
            
            //SomeButton code reference #3
            var mySimpleFolderRef = repo.MyAppFolder.MyRootedFolder.MySimpleFolder;
            mySimpleFolderRef.SomeButton.Click();
        }
After moving SomeButton[/i] to MyAppFolder.MyRootedFolder the code will be updated to:

Code: Select all

        public void Mouse_Click_SomeButton()
        {
        	//SomeButton code reference #1
            repo.MyAppFolder.MyRootedFolder.SomeButton.Click();
            
            var myRootedFolderRef = repo.MyAppFolder.MyRootedFolder;
            //SomeButton code reference #2
            myRootedFolderRef.SomeButton.Click();
            
            //SomeButton code reference #3
            var mySimpleFolderRef = repo.MyAppFolder.MyRootedFolder.MySimpleFolder;
            mySimpleFolderRef.SomeButton.Click();
        }
SomeButton code reference #3 will still cause a compile error, and will need to be updated manually.


Regards,
Ron