Rhino.Inside in CI for unit testing

Hi, I am following the UnitTest sample to write tests for my Grasshopper plugin. My understanding is that Rhino must be installed for Rhino.Inside, and this method of writing unit tests, to work correctly. Please correct me if I am wrong.

Then, is there a way to completely silently install Rhino, to be able to run these tests in CI, for example? I tried following the Automating installation Rhino 7 for Windows: Scripted Install guide but when I provide a license key, the installation pops up a dialog for license validation, which requires human interaction to complete, or when I do not provide a license key the installation pops up a dialog requesting my email address to go look for a license key, which again requires human intervention.

1 Like

Paul -

How are you licensing the Rhino 7? Cloud Zoo (Rhino account) or trying to type it directly into the installer?

Also, which Operating system are you installing on exactly?

Edited the post to include the ā€œwindowsā€ tag because I am trying this install on Windows.

I am not sure how it is licensed. I am part of a team developing a Grasshopper plugin, and the list of license for my team shows licenses for Rhino 7 Not For Resale Lab. I tried providing the LICENSE_KEY parameter to the automated installation procedure, and I tried without.

Yes, but is it Windows Desktop or Windows Server?

Right now I am trying to get this workflow to run on my local workstation, so Windows 11, but eventually I want this to run in CI on Windows Server 2019 or 2022.

Do you need to install Rhino every time your tests run? What environment or platform are you eventually hoping to run your tests in?

My preference is to start fresh on each CI run, so yes I would prefer installing Rhino each time. Eventually I want this to run on CircleCI on Windows Server 2019 or 2022.

Is the suggestion here to create a Docker image that has Rhino installed (and license validated) and use that as the basis for unit tests? Does this mean that there is no way to perform a silent install that does not require human interaction?

The only option for CircleCI will be to use core-hour billing. Unfortunately we donā€™t have an NFR program for core-hour billing.

I have a basic question: NFR means ā€œnot for resaleā€?

And I still donā€™t quite know the answer to my original questions: Is Rhino required to be installed to use Rhino.Inside, even for something like unit testing? How to automate the install of Rhino so it is completely silent and does not require human interaction?

@brian - knows the best approach to that. He happens to be out this week, He will be back next week to take a look at this.

Hey @Paul_Novak Rhino.Inside uses Rhinos core library which requires a license. Even when we perform unit testing we have a Rhino Install that uses the Zoo License on a pre-installed machine.

I would love to be able to set up a machine from scratch each time we run tests, so Iā€™ll be watching this thread closely.

Any reason not to set up an image that already has everything set up and boot one of those up each time?

ā€“ cs

@csykes I prefer to start from scratch each time for good test hygiene, making sure there are no unexpected dependencies, that sort of thing. It sounds like a setting up an image with Rhino installed and set up, as you have done, is something I will have to do.

@Paul_Novak I actually havenā€™t gotten to the clean image boot-up each time yet, Iā€™d love to know how to do it. Our test machine opens/closes Rhino and does not reset each time which does cause issues

Hi, any update on this topic? Specifically, is there a way to completely silently install Rhino? I tried following the Automating installation Rhino 7 for Windows: Scripted Install guide but when I provide a license key, the installation pops up a dialog for license validation, which requires human interaction to complete, or when I do not provide a license key the installation pops up a dialog requesting my email address to go look for a license key, which again requires human intervention.

I recommend that you prototype your workflow on Windows Server, because the licensing requirements for Rhino are very different on Windows Desktop vs Server. Youā€™ll need to use Core-Hour billing on Windows Server to run your CI workloads. And setting up core-hour billing is something that can be done in a completely automated way.

For details on setting up Rhino for automated workloads on Windows Server, please read Rhino - Licensing & Billing

If you stick with desktop, the only way to license Rhino in a way that install is completely automated is to use LAN Zoo. Put your license in the LAN Zoo server, and point to it from your Rhino install.

1 Like

Hey @brian,

Iā€™ve been trying this using CircleCI and a custom Rhino Orb. Iā€™ve managed to install Rhino headlessly, and Iā€™ve been attempting to use the core hour billing. However I keep getting this error

Setup failed for test fixture TestSetup
System.Runtime.InteropServices.COMException : Error HRESULT E_FAIL has been returned from a call to a COM component.
StackTrace:    at Rhino.Runtime.InProcess.RhinoCore.InternalStartup(Int32 argc, String[] argv, StartupInfo& info, IntPtr hostWnd)
   at Rhino.Runtime.InProcess.RhinoCore..ctor(String[] args, WindowStyle windowStyle, IntPtr hostWnd)
   at NUnitTestFixture.StartRhino()
   at NUnitTestFixture.Init(FixtureOptions options)
   at TestSetup.Setup() in C:\Users\circleci.PACKER-64370BA5\project\tests\Tests\Setup.cs:line 12
  Failed Any [2 s]
  Error Message:
   OneTimeSetUp: System.Runtime.InteropServices.COMException : Error HRESULT E_FAIL has been returned from a call to a COM component.

Iā€™m assuming this is a licensing error, if not, hurray! Licensing works!
Is this possible to test locally? Iā€™ve tried setting the env var on Windows, but Rhino still asks for a license.

ā€“ cs

Hey @csykes Iā€™ve been talking with @will - heā€™s suggesting trying to reproduce the install, setup, and launch process on a Windows Server instance that you have GUI access to?

Or, if you have GUI access to the CircleCI server, what happens when you start Rhino itself? Do you get licensing errors in this state? Unfortunately, the error messages coming from Rhino.Compute are pretty sparse.

1 Like

I just found this article, Iā€™m posting it here just in the interest of full documentation for any readers. Iā€™ll give it a test later :blush:

All good news from my testing!

  • I was able to RDP into the machine! Itā€™s a real windows machine with a GUI
  • I was able to open up Rhino, and it works as expected
  • Rhino was also correctly licensed!
  • I was able to run the tests that had already been cloned on the machine by calling dotnet test

Next steps (for me)

I will create a step in the CI/CD that opens Rhino for the first time, I assume that might be the issue.

ā€“ cs

I added a new step to open Rhino once with a 60s timeout, I hoped it would solve the issue, but when I RDP in I get the standard ā€œWelcome to Rhino, please enter your email to get startedā€? If I close then then open Rhino normally it works fine.

I opened up the repo for now. I was hoping to get it working with lots of lazy commit messages, then start from scratch and Open Source it with abit more effort, but here we find ourselves.

ā€“ cs