Changing namespace for repository generated code

Bug reports.
lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Changing namespace for repository generated code

Post by lyn5000 » Wed Mar 14, 2012 11:12 pm

In http://www.ranorex.com/support/user-gui ... ialog.html it says in the Current Repository tab you can specify the class name and the namespace of the automatically generated source code for the current repository.

If I open a repository in my Ranorex Studio solution and click Settings and change the namespace in the Current Repository tab->click OK, then rebuild the solution the namespace in the tab just reverts back to what it was before I changed it.

I can't figure out why and if I need to change it somewhere else to stop this happening?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Changing namespace for repository generated code

Post by Support Team » Thu Mar 15, 2012 9:41 am

Hi,

Which Ranorex version are you using, the actual 3.2.2?
If not please download it here and test if the issue also occurs with the new version.

Regards,
Markus
Ranorex Support Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Thu Mar 15, 2012 5:02 pm

Yes 3.2.2

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Thu Mar 15, 2012 5:30 pm

Repro:

1. Open Ranorex Studio
2. File->New->Solution
3. Select Ranorex C# Test Suite template
4. Name your project
5. Click Create
6. In the Projects pane, double-click the repository rxrep file listed in the solution tree
7. Click "SETTINGS..." in the tab that opens for the repository
8. Click Current Repository tab in the Settings dialog
9. Change Repository namespace to something else (e.g. change it from "Blah1" to "Blah1a").
10. Click Apply->OK
11. Build->Rebuild Solution
12. Click "SETTINGS..." again for the repository

What happened:
Repository namespace has reverted back to the original string ("Blah1").

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Changing namespace for repository generated code

Post by Support Team » Fri Mar 16, 2012 11:53 am

Hi,

Thanks for describing the issue in detail.
For that case we have made a mistake because you shouldn't be allowed to change the namespace of the repository, we have missed to disable this option in the settings window.
I will add a bug and we will discuss internally if it is useful if you are allowed to change the namespace of a single repository.

Regards,
Markus
Ranorex Support Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Fri Mar 16, 2012 4:34 pm

Thank you. It would definitely be useful since when I change the namespace used in other files in my solution (such as namespaces used in .cs files for classes) I sometimes want to put a repository that already exists in the renamed namespace as well for design and consistency reasons in the solution.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Changing namespace for repository generated code

Post by Support Team » Mon Mar 19, 2012 2:37 pm

Hi,
lyn5000 wrote:Thank you. It would definitely be useful since when I change the namespace used in other files in my solution (such as namespaces used in .cs files for classes) I sometimes want to put a repository that already exists in the renamed namespace as well for design and consistency reasons in the solution.
As you said to rename the namespace make sense, therefore we have to adapt the code generation for the repository. In the next Ranorex release this bug will solved.

Regards,
Peter
Ranorex Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Sun Sep 16, 2012 6:50 am

I still can't change the namespace that is generated by a Ranorex repository :(

The namespace is grayed-out if I open the repository in Ranorex Studio and look at settings and if I open the repository in Spy and look at settings the namespace is NOT grayed-out but changing the namespace doesn't change the generated code.

Ranorex 3.3.2

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Changing namespace for repository generated code

Post by artur_gadomski » Mon Sep 17, 2012 7:18 am

Are you changing Repository Defaults settings or Current Repository in Spy?
For me it works as expected.

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Tue Sep 18, 2012 8:05 pm

I tried both.

1. Open Ranorex Studio
2. File->New->Solution
3. Select Ranorex C# Test Suite template
4. Name your project
5. Click Create
6. In the Projects pane, double-click the repository rxrep file listed in the solution tree
7. Click "SETTINGS..." in the tab that opens for the repository
8. Click Current Repository tab or Repository Defaults in the Settings dialog and notice Repository Namespace is grayed-out.
9. So open the repository in Spy instead (in the Projects pane, right-click the repository rxrep file->open with->Ranorex Spy)
10. Click SETTINGS... in Spy for the repository.
11. Click Current Repository tab or Repository Defaults in the Settings dialog and notice Repository Namespace is NOT grayed-out.
12. In either or both tabs change Repository namespace to something else (e.g. change it from "Issue2" to "Issue2.Test").
13. Exit Spy.
14. Click Yes when prompted to save changes.
15. Build->Rebuild Solution, or exit Ranorex Studio, re-open the solution and rebuild.

What happened:
Look at the Ranorex auto-generated .cs file for the repository and notice the namespace has not changed.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Changing namespace for repository generated code

Post by Support Team » Wed Sep 19, 2012 10:08 am

Hi,

Is there a special reason why you want to change the namespace of the repository?
Maybe we can find another way for what you want to do.

Regards,
Markus
Ranorex Support Team
.
Image

lyn5000
Posts: 50
Joined: Mon Feb 13, 2012 5:52 pm

Re: Changing namespace for repository generated code

Post by lyn5000 » Wed Sep 19, 2012 5:54 pm

Yes, it's to do with my framework API so that types are organized correctly in appropriate namespaces. I have repositories that I would like to keep in the same namespace as classes that create instances of them.

Since Ranorex generates the namespace based on the root namespace specified in the project+the folder hierarchy below the root project where the repository is kept, I have to put the repositories in a specific folder hierarchy in order for the generated namespace to be the same as that used by classes that use them. This is not as flexible as being able to keep the repositories in the project folder I want and still have the namespace that I want them in.

Also another question related to the auto-generated code, is it possible to use a different access modifier other than public for the generated repository class code? Would be nice to have the option to make it internal to the assembly so that users of the assembly only see public classes in the assembly (that use the internal repository classes) and not the repository classes as well. Again this would help with my API design.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Changing namespace for repository generated code

Post by Support Team » Thu Sep 20, 2012 1:16 pm

Hi,

Regarding changing the namespace of a repository, this is a Ranorex limitation, you cannot change the namespace of the repository only, except when you copy it to another folder/project as you described.

Thank you for this suggestion, I will add it to our internal feature request list and we will internally decide if we will implement this feature in one of our future releases.

Regards,
Markus
Ranorex Support Team
.
Image