Switching between Automation Roots?

Mobile Testing, Android App Testing.
Machisperer
Posts: 7
Joined: Wed May 02, 2018 3:48 pm

Switching between Automation Roots?

Post by Machisperer » Fri Aug 31, 2018 6:58 pm

Hi,
The mobile app I'm testing needs to interact with another application on a desktop. In my test cases, user needs to perform certain actions on the mobile app and some other actions on the desktop. So my question is as follows:
Is it possible to programmatically switch between two automation roots (i.e. a mobile device and a desktop) within the same automated test case?

Thanks for any tips or suggestions...

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Switching between Automation Roots?

Post by Support Team » Mon Sep 03, 2018 1:42 pm

Hello Machisperer,

Thank you for your post.
In order to switch to a specific endpoint during test run, the following codeline can be used:

Code: Select all

Host.MakeCurrentHost("Name of your Endpoint");
If you want to switch from an endpoint to the desktop, please use the following line:

Code: Select all

Host.MakeCurrentHost("Localhost");
regards,
Stephan

Machisperer
Posts: 7
Joined: Wed May 02, 2018 3:48 pm

Re: Switching between Automation Roots?

Post by Machisperer » Thu Sep 06, 2018 5:15 pm

Thanks Stephan! Exactly what I needed

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Switching between Automation Roots?

Post by Support Team » Fri Sep 07, 2018 11:19 am

Perfect!
I'm glad, I could help.

Kind regards,
Stephan

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Switching between Automation Roots?

Post by jsmith » Tue Oct 23, 2018 10:26 am

Does anyone have any clue as to apply the lessons above to multiple endpoints? I want to run the same test suite through each of my endpoints, one after the other...

User avatar
qwertzu
Posts: 284
Joined: Wed Jan 25, 2017 11:08 am

Re: Switching between Automation Roots?

Post by qwertzu » Tue Oct 23, 2018 3:01 pm

Hi,

I would suggest creating a batch file that runs the test on all your endpoints.
In your output folder you can find shortcuts for each of your endpoints.
EndpointShortcuts.png
You can run a test on a specific endpoint if you run the related shortcut.

So in your case, you could create a batch file that executes all shortcuts one after the other.

regards, qwertzu
You do not have the required permissions to view the files attached to this post.

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Switching between Automation Roots?

Post by jsmith » Tue Oct 23, 2018 3:14 pm

Thanks qwertzu, I shall look into that option once I have exhausted my current one. I can switch endpoint programmatically, so I can create a list of my endpoints, and loop through each of those list items, executing the test suite on each. At least, that is the idea.
So far, I have two unknowns:
Unknown One:
Can I run a whole test suite from code? i.e :

Code: Select all

public static void runatest()
        {
        	MyProject.Specific_Test.Start();
        }
This will run one test case (an .rxrec in my case). But I want to run:

Code: Select all

public static void runaproject()
        {
        	MyProject.Start();
        }
This would run a whole .rxtst

Unknown two:
Can I get a list of endpoints programmatically?

Thats where I'm at at the moment, any pointers or advice would be much appreciated.

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Switching between Automation Roots?

Post by jsmith » Tue Oct 23, 2018 3:26 pm

Unknown two is solved:

Code: Select all

List<string> available_hosts = new List<string>();
            	
            	
            	available_hosts = Host.AvailableHosts.ToList();
            	
            	foreach( string possibility in available_hosts)
            	{
            		Report.Log(ReportLevel.Info, possibility);
            	}

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Switching between Automation Roots?

Post by jsmith » Thu Nov 01, 2018 10:30 am

jsmith wrote:
Tue Oct 23, 2018 3:14 pm
Thanks qwertzu, I shall look into that option once I have exhausted my current one. I can switch endpoint programmatically, so I can create a list of my endpoints, and loop through each of those list items, executing the test suite on each. At least, that is the idea.
.......
....
But I want to run:

Code: Select all

public static void runaproject()
        {
        	MyProject.Start();
        }
This would run a whole .rxtst

Just revisiting this this morning. Can anyone advise if they have successfully started a whole test suite from code?

jsmith
Posts: 36
Joined: Mon Mar 05, 2018 4:03 pm

Re: Switching between Automation Roots?

Post by jsmith » Fri Nov 02, 2018 4:31 pm

Okay so I have found a solution.
I have created an excel document which lists the name of each of my endpoints.
Then set this document as a datasource for my test case
I have then created a User code to change Endpoint to whatever string I pass in as a parameter.
Then I have bound the data to the recording.
And set the input parameter for the User code call as a variable.

This is working pretty much perfectly.