Page 1 of 1

Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 10:43 am
by vishalkulkarni
https://ranorex.com/forum/floating-lice ... t1970.html

Currently in Ranorex studio 9.2 we see this feature.
When there are license in use, the test suite waits till license availability and then begins execution.

However when running test suite exes using command line in pipeline, the execution fails stating license not available.
How to ensure similar behavior to be done for command line execution.

Wait for license to be available and then execute the suite.

Re: Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 11:06 am
by odklizec
Hi,

What you need is to implement WaitForAvailableLicense method in Program.cs, as described for example here...
running-tests-on-numerous-machines-t8803.html#p35582
Hope this helps?

Re: Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 12:11 pm
by vishalkulkarni
Hi ,

Thank you so much, will try this.

Re: Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 1:50 pm
by vishalkulkarni
So I tried this.
I removed the license server configuration from where license was being fetched.

I created a console exe which contains the code snippet

Code: Select all

 bool licenseAvailable = Ranorex.Core.ElementEngine.WaitForValidLicense(new Ranorex.Duration(timeout * 1000), new Ranorex.Duration(checkInterval * 1000));

                if (licenseAvailable)
                {
                    System.Console.WriteLine("Yeah... license avaliable!");
                    return (int)ExitCode.Success;
                }
                else
                {
                    System.Console.WriteLine("Doh... no license avaliable.");
                    return (int)ExitCode.NoLicenseAvailable;
                    }
Now i run the exe it returns license available.

However when I run Ranorex studio, it pops up the dialog to configure license or activate trial license.

After this again if i run the exe it still says license is available.

I see similar problem here
waitforvalidlicense-returns-true-even-i ... t4653.html

Can you help.

Re: Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 1:59 pm
by odklizec
Hi,

So are you using floating license? And the machine where you run the test is properly configured to reach the license server? Ideally, install whole Ranorex Studio on the target machine and configure the license via license manager.

Re: Wait for license in Devops pipeline- Floating license

Posted: Thu Sep 17, 2020 7:33 pm
by vishalkulkarni
Yes, My problem is following.
I am running suites on virtual machines configured as azure devops pipeline agents
All of them are configured to connect to license server.
I have more vm's than licenses.

Most of times tests pass as they get license

Sporadically few suites fail stating they were not able to get license as all licenses were being used.


Hence I thought I could use this snippet to make a vm wait for license, get the license and then start executing test cases.

However the code snippet never reports that there is no license. Even though there is no license with which test suite could progress successfully.