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
Difference between Host.Local.FindSingle<Form>& Object repo
Re: Difference between Host.Local.FindSingle<Form>& Object repo
I have also recently started thinking about this.
Re: Difference between Host.Local.FindSingle<Form>& Object repo
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:
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
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:
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.