Page 1 of 1

Web License Manager

Posted: Tue Nov 29, 2016 12:56 pm
by radoslav.rakar
Hello,

I have a simple question. Is it possible to get number of used licenses from web?
We are using 30 licenses for our testing. But its difficult always go to look on our license server on virtual machine.
Simple for us will be to look on web if is it free licenses to start testing.

Thanks

Rado Rakar

Re: Web License Manager

Posted: Tue Nov 29, 2016 2:28 pm
by odklizec
Hi,

As far as I know, there is no web-based license manager available. The only way is to view the available licenses directly via License Manager (started on license server).

Anyway, if you just want to start your tests on VM (e.g. from command line), you can add a simple code to your test that will make sure the test waits for next available license. So the test will not immediately fail if there is no license available at the moment of test start. I'm using code like this:

Code: Select all

		/// <summary>
		/// This method checks and waits for available Rx license
		/// </summary>
		/// <param name="WaitForLicenseTimeout">wait time for available license (before giving up)</param>
		/// <param name="WaitForLicenseInterval">license check interval</param>
		/// <returns></returns>
		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;
			}
		}
And this line of code must be placed as a very first action in Main method in Program.cs...

Code: Select all

            // check if Ranorex license is available (if not available, wait for 15mins/check every 5secs)
            WaitForAvailableLicense(900000,5000);