Add Android Endpoint via C#, then make Current Host?
Posted: Thu Jun 25, 2020 10:05 pm
I'm trying to figure out how to add an Android endpoint using C# and then make it the Automation Root - But not by using Studio.
I've read several posts that kind of get at what I'm looking to do, but I'm not understanding something quite right and cant get things to work.
https://www.ranorex.com/forum/viewtopic ... 465#p54606
https://www.ranorex.com/forum/viewtopic ... int#p51229
We plan on using CI and Emulators to do Android testing. I'd like the setup of this to be as automated as possible.
That being said, what I cant figure out is how to set the automation root to the device I create using C# so that the "Deploy Android app" "Current Endpoint (None)" gets pointed at the device I created that is running in the emulator.
When I have 0 Endpoints manually pre-configured within Studio:
When I pre-create an endpoint manually using Studio
Is it possible? What am I missing here?
I've read several posts that kind of get at what I'm looking to do, but I'm not understanding something quite right and cant get things to work.
https://www.ranorex.com/forum/viewtopic ... 465#p54606
https://www.ranorex.com/forum/viewtopic ... int#p51229
We plan on using CI and Emulators to do Android testing. I'd like the setup of this to be as automated as possible.
That being said, what I cant figure out is how to set the automation root to the device I create using C# so that the "Deploy Android app" "Current Endpoint (None)" gets pointed at the device I created that is running in the emulator.
When I have 0 Endpoints manually pre-configured within Studio:
- I do the logic as shown in AddEndpoint() to create the device. I give it a name such as 'emulator' and all of that works fine.
Host.MakeCurrentHost("emulator") throws an error: Failed to set endpoint as element tree root. No endpoint with the name 'emulator' was found. There are 0 endpoints available: [].
And ICollection<Ranorex.Core.Remoting.IRemoteEndpoint> allep = RemoteServiceLocator.Service.AllKnownEndpoints returns 1 entry that is my device I created via C#.
But Host.AvailableHosts.ToList() only returns 1 entry for Localhost.
When I pre-create an endpoint manually using Studio
- Host.AvailableHosts.ToList() contains both Localhost as well as my manually created 'emulator' entry
Host.MakeCurrentHost("emulator"); works without error
Host.CurrentHost returns "emulator"
Is it possible? What am I missing here?