How to execute test cases in multiple devices?

Best practices, code snippets for common functionality, examples, and guidelines.
sunil.pandey
Posts: 11
Joined: Fri Jul 03, 2015 5:35 pm

How to execute test cases in multiple devices?

Post by sunil.pandey » Fri Jul 10, 2015 7:09 am

Hi,

can anybody please let me know
"How to execute test cases in multiple devices if I've only one Ranorex licence (Using Jenkins)"

Thanks & Regards,
Sunil

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to execute test cases in multiple devices?

Post by odklizec » Fri Jul 10, 2015 7:20 am

Hi,

If you have just one license, you will have to run your tests sequentially. Once a test is finished on one device, you can start it on another. Eventually, you can add a "wait for available license" method to your solution, so the tests will not fail due to unavailable license ;) I'm using something like this:
public static int WaitForAvailableLicense(int WaitForLicenseTimeout, int WaitForLicenseInterval)
		{
			System.Console.WriteLine("Waiting for RX license...");
			bool RXLicenseAvailable = Ranorex.Core.ElementEngine.WaitForValidLicense(new Ranorex.Duration(WaitForLicenseTimeout), new Ranorex.Duration(WaitForLicenseInterval));
			if (RXLicenseAvailable)
			{
				System.Console.WriteLine("Rx license available.");
				return 1;                    
			}
			else
			{
				System.Console.WriteLine("No Rx license available! (waited " + TimeSpan.FromMilliseconds(WaitForLicenseTimeout).TotalMinutes.ToString() + " mins)");
				return 0;
			}
		}
The above method must be called as the very first thing in Program cs, e.g. like this:
// wait for license 15mins/check every 5secs       
            WaitForAvailableLicense(900000,5000);
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration