error messages of GlobalRepository

Ranorex Spy, Recorder, and Studio.
yoad
Posts: 39
Joined: Sun May 26, 2013 9:08 am

error messages of GlobalRepository

Post by yoad » Sun May 26, 2013 9:10 am

I used in the samples of ranorex and I wrote in my code
using Ranorex.Core.Repository;
GlobalRepositoryrepo=GlobalRepository.Instance;

but i got error messages :
1.The name 'GlobalRepository' does not exist in the current context (CS0103) - C:UsersYoadDocumentsRanorexRanorexStudio Projectstest_for_objectstest_for_objectsRecording1.UserCode.cs:37,34

2.
The type or namespace name 'GlobalRepository' could not be found (are you missing a using directive or an assembly reference?) (CS0246) - C:UsersYoadDocumentsRanorexRanorexStudio Projectstest_for_objectstest_for_objectsRecording1.UserCode.cs:37,10


how I fix error messages?

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

Re: error messages of GlobalRepository

Post by Support Team » Tue May 28, 2013 8:59 am

Hello,

This message means that Ranorex cannot find the class GlobalRepository.
Is there a repository with this name available in your project?
In order to get more information how to use a repository in user code please read the section "Using Repository in Code" in our user guide.

Regards,
Bernhard
.
Image

yoad
Posts: 39
Joined: Sun May 26, 2013 9:08 am

Re: error messages of GlobalRepository

Post by yoad » Thu May 30, 2013 9:55 am

hello Bernhard,
I used your code of website
http://www.ranorex.com/support/user-gui ... html#c3196
in the file check.rxrec-->check.cs
and this is not working
also I can't save your code my project why?

tnx
Support Team wrote:Hello,

This message means that Ranorex cannot find the class GlobalRepository.
Is there a repository with this name available in your project?
In order to get more information how to use a repository in user code please read the section "Using Repository in Code" in our user guide.

Regards,
Bernhard

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

Re: error messages of GlobalRepository

Post by Support Team » Fri May 31, 2013 3:55 pm

Hello,

In order to analyze the issue I would like to take a look at your project.
Can you send the project to [email protected] or can you attach it to your next post.
I think this is the fastest way in order to fix the issue.
Thank you!

Regards,
Bernhard
.
Image

yoad
Posts: 39
Joined: Sun May 26, 2013 9:08 am

Re: error messages of GlobalRepository

Post by yoad » Sat Jun 01, 2013 3:41 pm

hello Bernhard
I sent my project here
Regards,
Yoad
Support Team wrote:Hello,

In order to analyze the issue I would like to take a look at your project.
Can you send the project to [email protected] or can you attach it to your next post.
I think this is the fastest way in order to fix the issue.
Thank you!

Regards,
Bernhard
Attachments
test_for_objects.zip
(205.43 KiB) Downloaded 183 times

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

Re: error messages of GlobalRepository

Post by Support Team » Mon Jun 03, 2013 3:27 pm

Hello,

Thank you for the project.
As I supposed, the repository in your project is not the same as you call in your code. Please try the following line in order to create an instance of the repository in your user code module.
test_for_objects.test_for_objectsRepository repo = test_for_objects.test_for_objectsRepository.Instance;
Additionally I have seen that your repository is empty. That means that the following lines will also not work.
repo.MyApp.Self.Activate();
Report.Info(repo.MyApp.Self.Active.ToString());
repo.MyApp.Self.Maximize(); 
.
.
.
In order to get more information how to work with the repository I would suggest to take a look at the section "How to build up and maintain a Repository in Ranorex" in our user guide. There are a lot of videos which will help you to understand how Ranorex works with the repository.

Regards,
Bernhard
.
Image

yoad
Posts: 39
Joined: Sun May 26, 2013 9:08 am

Re: error messages of GlobalRepository

Post by yoad » Wed Jun 05, 2013 4:05 pm

it is not working for me
i send you new project with program.cs and codemodule.cs
Attachments
test_for_objects_C#.zip
(10.52 KiB) Downloaded 286 times

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

Re: error messages of GlobalRepository

Post by Support Team » Thu Jun 06, 2013 1:38 pm

Hello,

Thank you for your project.
In your project is no repository and no test suite. If you do not have a repository in your project you cannot use it in code.
Why do you want to implement the tests in user code? I think it would be easier to use the record and play approach in order to write tests.
Please read the user guide in order to get more information how to work with Ranorex.
However, I changed your first project and added a repository item using the Microsoft calculator.
I really would suggest to read the user guide from the beginning.
Thank you!

Regards,
Bernhard
Attachments
test_for_objects.zip
(16.72 KiB) Downloaded 263 times
.
Image

yoad
Posts: 39
Joined: Sun May 26, 2013 9:08 am

Re: error messages of GlobalRepository

Post by yoad » Sun Jul 07, 2013 8:42 am

thank you