Hi,
I have 2 repositories in my project for 2 different user interfaces:
1. TestProject_1Repository.rxrep
2. TestProject_2Repository.rxrep
In the code module:
TestProject_1Repository repo1 = TestProject_1Repository.Instance;
TestProject_2Repository repo2 = TestProject_2Repository.Instance;
I want to reuse the same code module for these 2 interfaces, for example:
if (interface1) repo = repo1
if (interface2) repo = repo2
and so, my code module should use only
repo.LoginWin.ButtonLogin.Click();
instead of
if (interface1)
repo1.LoginWin.ButtonLogin.Click();
if (interface2)
repo.2.LoginWin.ButtonLogin.Click();
Is it possible to do so? If yes, how can I assign repo = repo1 and repo = repo2 based on user interface selection?
Thanks
Using 2 different repositories
-
- Posts: 254
- Joined: Tue Mar 24, 2015 5:05 pm
- Location: Des Moines, Iowa, USA
Re: Using 2 different repositories
There are a couple of ways you could work around this, but I'm not so sure it's a great idea. You might be better served with having a test suite with separate projects for interface 1 and 2. Otherwise you could simply create your objects to account for both interfaces in the RxPath.
To work around this all you really need to do is override the instance of your repository at run time which is fraught with dangers and pitfalls.
To work around this all you really need to do is override the instance of your repository at run time which is fraught with dangers and pitfalls.
Doug Vaughan
-
- Posts: 77
- Joined: Wed Sep 26, 2012 8:15 pm
Re: Using 2 different repositories
Thanks for your answer
-
- Posts: 254
- Joined: Tue Mar 24, 2015 5:05 pm
- Location: Des Moines, Iowa, USA
Re: Using 2 different repositories
Best of luck, and please do come back and let the community know what you decide and how it goes. Your question is fairly common and If you come up with an elegant solution I'm sure it could benefit others, my self included.monkey2012 wrote:Thanks for your answer
Doug Vaughan