Difference between Host.Local.FindSingle<Form>& Object repo

Ask general questions here.
pyedisane
Posts: 1
Joined: Fri Feb 17, 2017 12:03 am

Difference between Host.Local.FindSingle<Form>& Object repo

Post by pyedisane » Sun Feb 19, 2017 11:59 pm

Hi,

I have a bit of experience in Ranorex, I just want to understand the difference between using Host.Local.Findsingle<Form> and using the repository to find an element.

Which one would be quicker and reliable?

Do they make any difference?

It's just that with Host.Local.Findssingle, values(usually xpaths) assigned to variables are hard coded in the beginning of the script. Could this lead to performance issues?

Thank you

aaron03
Posts: 1
Joined: Thu Mar 09, 2017 9:21 am
Location: Auatralia

Re: Difference between Host.Local.FindSingle<Form>& Object repo

Post by aaron03 » Thu Mar 09, 2017 9:27 am

I have also recently started thinking about this.

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Difference between Host.Local.FindSingle<Form>& Object repo

Post by McTurtle » Fri Mar 10, 2017 1:48 pm

Hello guys,

Reading this also made me curious. I tested it using the windows calculator as the repository object. What I did:

1. Create new Ranorex Test Suite
2. Create 2 Test Cases
3. The first Test Case (Using Findsingle) contains one recording with a user code action containing in the main method the following code:
var Multiply_Button = Host.Local.FindSingle(@"/winapp[@packagename='Microsoft.WindowsCalculator']/?/?/button[@automationid='multiplyButton']");
for(int i=0; i<20; i++)
{
Multiply_Button.As<Button>().Click();
Report.Info("Clicked on multiply button in Windows Calculator using Host.Local.FindSingle() 20 times." );
4. The second Test Case (Using Ranorex Respository) contains one recording with a user code action containing in the main method the following code:
var Multiply_Button=repo.Kalkulator.MultiplyButton;
for(int i=0; i<20; i++)
{
Multiply_Button.Click();
}
Report.Info("Clicked on multiply button in Windows Calculator using the Ranorex Repository 20 times." );
5. Run the Test Suite and get the report something like this:
Findsingle_vs_Repo.png
To your questions:

Which one would be quicker?
The repository. Why? Because of caching.

Which one would be more reliable?
The one that has the robuster RanoreXPath ;)

Do they make any difference?
Yes. If you are using the repository it provides for very good transparency and re-usability.

It's just that with Host.Local.Findssingle, values(usually xpaths) assigned to variables are hard coded in the beginning of the script. Could this lead to performance issues?
Both the Repository and variables you declare using Findsingle are hard. There should be no difference. What do you mean?

Regards,
McTurtle
You do not have the required permissions to view the files attached to this post.