Automated testing with Rhino ✅

Hello! A few of us have been working to make some tools for 3rd party developers interested in running automated tests of their plugins with Rhino.

  • Rhino.Testing - NUnit dotnet unit testing for Rhino3D. Available as a nuget package.
  • setup-rhino3d - A GitHub Action for downloading and installing the latest published Rhino service release on Windows runners.
  • SimpleRhinoTest - A demonstrator of putting those two projects together to build and test a Rhino plugin. Includes a workflow for running automated testing with GitHub Actions.

We are looking for some feedback on how these projects could help your development experience.

14 Likes

Where have you been all my life? :heart::heart:

In general got it up and running quite well.

I have some minor issues but we could discuss them in Copenhagen at the Developer Meetup :slight_smile:

2 Likes

Hello, I love the work you guys did, thanks!
Trying to unit test methods in a Rhino8 Grasshopper plugin with the SimpleRhinoTest, how would you need to set up a net7.0 Grasshopper Plugin .csproj before adding it as build/project dependency to test methods within (that include RhinoCommon and Grasshopper types)?

  • I keep running into Failed to create CoreCLR
    Cheers Tim

This is amazing! :rocket: thank you so much for putting the effort and sharing this, we really need some nice tools for CI with Rhino/Grasshopper. Many thanks!

I was wondering @fraguada @eirannejad if you have any recommendations to run tests in Python for both Rhino and Grasshopper in GitHub Actions. I was thinking to use you wonderful setup-rhino3d and run tests/scripts heedlessly via the RhinoInside or is there a better way? thanks :open_hands:

@andrea.settimi

Rhino.Inside would be the way to do it. You’d need a token to get it loaded on a CI machine since it will be probably running on a windows server so just keep that in mind. rhinoinside on PyPI would be a good start to bootstrap rhino inside in your python 3 test process.

2 Likes

@fraguada @eirannejad
I am still having trouble testing the methods in a plugin GHPluginTests, although directly using the Grasshopper Plugin Template and change the project settings to match to the

I uploaded and documented the steps I took and the project here:

I’d really appreciate any help on this!

Some feedback about setup-rhino3d:

  • It would be great to be able to specify the major version to install (e.g. 6, 7, 8, wip).
  • Email does not seem to be technically required to download Rhino with your API. Making it optional would reduce friction.
  • README could clarify that a RHINO_TOKEN is required to run Rhino, but not really required to install it. This is relevant since install and run might be in different jobs or workflows. Or some workflows might not need to run at all, when they just install Rhino to get the DLLs for a plugin build.
  • An option to cache the install between jobs. In my tests, downloading and installing Rhino takes between 1 and 2 minutes on a windows2022 GitHub runner. It might be possible to reduce that with caching.
  • Setting the exact installed version (e.g. 8.11.24254.15001) as an action output. This can be used by workflows to setup caches that are invalidated when the version changes.
  • Being able to pin the action to specific versions (not just major). So, for example, pinning to 8.11.24254.15001 instead of 8 (I guess this would also require setting the release date as a parameter, since that’s required to get the download URL).

If you’re open to consider these, I can also open pull requests for them.

1 Like

I have published my take on GitHub Actions integration at smola/setup-rhino3d. In its simplest form, it is used as:

- uses: smola/setup-rhino3d@v1
  with:
    rhino-version: '8'

It supports the features I described above (more info in the readme). The action does caching, which changes time to get Rhino from 1-2 minutes to ~15 seconds if the cache is warm. It is actively tested for Rhino version from 6 to 9 WIP on Windows.

4 Likes

Very nice! I like that it is all js (much better for maintenance) and includes caching.

1 Like

Thanks for the links! Separate from unit testing I’m thinking of some UI testing of a WPF-based Rhino Plugin. I think WinAppDriver would be a good tool for this, but are there ways that Rhino.Testing could improve my tests? I think having access to Rhino events during testing may be useful. I am guessing that this toolkit could be used alongside WinAppDriver for some fairly robust testing. Is this accurate?

Just found this topic…

So, if I understanded correctly, even I want to build my GH plugin with github action, McNeel will charge me for that because I need to use the compute-license?