/rhino:testingfrom rhino
Use when writing, running, or debugging tests of code that calls RhinoCommon, Grasshopper, or Grasshopper 2, covering in-process hosts, macOS setup, CI, and test design
Ships in rhino. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers tests that load an installed Rhino into the test process and drive documents, plug-ins, and Grasshopper solutions through RhinoCommon. Every test touching a RhinoCommon type needs an installed, licensed Rhino, as RhinoCommon geometry calls native Rhino libraries.
[REFERENCES]:
[TEMPLATES]:
Tests/Tests.csproj, with Rhino references, install gate, runtime, and dumpsRhinoCore through Rhino.InsideInterface aloneTemplates test a placeholder project Library (Slabs.Extrude, Slabs.Place, SlabVolumeComponent), rename them to the code under test.
Pick host by platform and by what the code under test touches:
| [INDEX] | [HOST] | [PLATFORMS] | [FRAMEWORK] | [USE] |
|---|---|---|---|---|
| [01] | Template host | Windows, macOS | xunit.v3 | Documents, plug-ins, Grasshopper 2, per-test Rhino checks |
| [02] | Rhino.Testing | Windows, Linux | NUnit | McNeel's harness, Grasshopper 1 .gh assertion files |
| [03] | Rhino-free project | Any | Any | Logic with no RhinoCommon type in its signatures or body |
| [04] | Running Rhino | Windows, macOS | None | Commands, views, dialogs, and anything needing user input |
Logic with no Rhino type belongs in a Rhino-free project tested everywhere, and Rhino-bound tests stay few and deep. Running Rhino (rhinocode, an MCP server, a launched app) suits interactive checks, never a test suite: rhinocode reports success on queuing a script, before it finishes.
Template host boots Rhino once on the process main thread and runs tests on a worker: macOS loads Rhino's frameworks into the test process (Darwin.cs, [02.2]-[BOOT]), Windows starts RhinoCore through Rhino.Inside (Windows.cs, [02.5]-[WINDOWS]), and both end the process once results are written.
global.json selects Microsoft.Testing.Platform for dotnet test:
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
dotnet test --project Tests/Tests.csproj
dotnet test --project Tests/Tests.csproj -- --filter-class 'Tests.SlabTests' --filter-method '*Undo*'
dotnet test --project Tests/Tests.csproj --configuration Release --no-build --results-directory <dir>
dotnet test --project Tests/Tests.csproj '-p:TestingPlatformCommandLineArguments=--report-trx --hangdump --hangdump-timeout 90s'
TestingPlatformCommandLineArguments precede every run's arguments, an option given twice fails with exit code 5, and -p: replaces the project value--filter-trait, --filter-namespace, --filter-not-*, and --filter-query select tests, --list-tests lists them without runningExit codes decide what to read next:
| [INDEX] | [CODE] | [MEANING] | [READ] |
|---|---|---|---|
| [01] | 0 | Every test passed | Nothing |
| [02] | 2 | One or more tests failed | Failure messages, Standard output of each failed test |
| [03] | 5 | Invalid command line | Option named in the message |
| [04] | 7 | Test host exited unexpectedly | Crash sequence log, crash report, macOS .ips report |
| [05] | 8 | Zero tests ran | Filter or test discovery |
Rhino.Testing is McNeel's NUnit harness (9.0.8-beta for Rhino 9, net48, net8.0, net9.0, and their -windows forms). Its macOS support sits in an unmerged pull request, and macOS tests use the template host:
Rhino.Testing.Configs.xml beside the test assembly (CopyToOutputDirectory) holds <Settings> with RhinoSystemDirectory, LoadGrasshopper, LoadGrasshopper2, LoadEto, LoadRDK, CreateRhinoDoc, CreateRhinoView, and <LoadPlugins><Plugin Location="..."/></LoadPlugins>RhinoSystemDirectory empty or missing lets Rhino.Inside find the install, an absolute path pins one, and 9.0.8-beta no longer resolves a relative path against the file[SetUpFixture] subclass of RhinoSetupFixture boots Rhino once per run, LoadGHA loads .gha files, and [RhinoTestFixture] boots Rhino at discovery for test cases whose data names RhinoCommon typesCreateRhinoDoc sets RhinoDoc.ActiveDoc to one shared headless document, and tests writing a document create their ownRhinoTestFixture.TestGrasshopper and RunGrasshopper solve a .gh file and return a GHReport of component messagesRhino catches exceptions inside its callbacks and writes command output only to its command window, tests see neither without these members:
| [INDEX] | [CHECK] | [MEMBER] | [REPORTS] |
|---|---|---|---|
| [01] | Swallowed exception | HostUtils.OnExceptionReport | Exceptions in InvokeOnUiThread, events, commands, plug-ins |
| [02] | Command output | RhinoApp.CommandWindowCaptureEnabled | Lines CapturedCommandWindowStrings(true) drains on main |
| [03] | Debug strings | HostUtils.SendDebugToCommandLine | HostUtils.DebugString lines in the captured output |
| [04] | Object validity | IsValidWithLog(out string log) | First openNURBS defect, log goes in the assertion message |
| [05] | Brep validity | Brep.IsValidTopology, then IsValidGeometry | Topology defect, then geometry defect, each with its log |
| [06] | Mesh defects | Mesh.Check(TextLog, ref MeshCheckParameters) | Degenerate faces, naked and non-manifold edges, intersections |
| [07] | Document integrity | RhinoDoc.Audit(TextLog, attemptRepair: false) | Table and object defects of the whole document |
| [08] | Undo grouping | RhinoDoc.GetUndoRecords() | Undo records newest first, with descriptions |
| [09] | Added object | ObjectTable.Add* return value | Guid.Empty on refusal |
IsValidTolerancesAndFlags, each assuming the one before passedRhinoApp.SendWriteToConsole output appears nowhere inside the test processRhinoApp.CheckNewObject adds invalid objects without a report, File3dm.IsValid and File3dm.Audit are obsolete and always passOnExceptionReport event and writes captured lines to the test's outputWith --hangdump or --crashdump on, Microsoft.Testing.Platform runs tests in a child process carrying --internal-testhostcontroller-pid, the process debuggers attach to:
| [INDEX] | [ARTEFACT] | [WRITER] | [HOLDS] |
|---|---|---|---|
| [01] | <assembly>_<id>_crash.sequence.log | --crashdump | Tests started and ended, last line without end is cause |
| [02] | <assembly>_<pid>_crash.dmp | --crashdump --crashdump-type Mini | Managed and native state at the crash |
| [03] | <dump>.crashreport.json | --crash-report-if-supported | Threads and frames of the crash as JSON |
| [04] | Hang dump | --hangdump --hangdump-timeout <time> | Process state when a test outlived the timeout |
| [05] | dotnet-<time>.ips | Crash reporter of macOS | Exception type, signal, and native frames of the crash |
| [06] | TRX file | --report-trx | Results, recovered after a crash |
tail -n +2 ~/Library/Logs/DiagnosticReports/dotnet-<time>.ips | jq -r '.exception.type, .exception.signal, (.faultingThread as $t | .threads[$t].frames[:12][] | .symbol // "?")'
get-task-allow, so a debugger attaches to itFull, type Mini keeps them near 200 MBDOTNET_DbgEnableMiniDump=1, DOTNET_DbgMiniDumpName, and DOTNET_EnableCrashReport=1 in one Exec task's EnvironmentVariables dump its process alone outside Microsoft.Testing.PlatformRhino <major>.app in /Applications or ~/Applications, and the host takes the major from the RhinoCommon pinRHINO_TOKEN licenses Windows Server and Linux alone, and a single-computer key binds one machine for goodRhino <major>.app/Contents/Frameworks/RhCore.framework/Resources/dotnet/<arch>/dotnet, the runtime Rhino itself runs onRhino for Mac boots inside the test process, with the process main thread running Rhino's run loop:
RhinoCore ignores arguments and WindowStyle, and its Run, DoEvents, and DoIdle throw EntryPointNotFoundExceptionMain adds a CoreFoundation run loop source, starts the test framework on a worker, and runs CFRunLoopRun()GetCLRRuntimeHost into coreclr_handle of libxamarin-dotnet-coreclr.dylib) and opens Rhino's frameworks with RTLD_GLOBALRhSetDotNetStartProc then has Rhino load dotnetstart.<runtime major>.dll and call Start, "headless" for mode HeadlessInterface, the default, calls RhinoMacLibraryStart(0) under MRApplication and AppController, with views and documents from NSDocumentControllerHeadless (dotnet test -c Headless) calls RhinoMacLibraryStart(1) without views, the mode CI runsRhCore.framework/Resources and each ManagedPlugIns/*.rhp folder, Grasshopper 2 includedNSApplication.Run(), and RhinoApp.InvokeOnUiThread, Eto InvokeAsync, and SwitchToMainThreadAsync reach themInvokeOnUiThread returns at once whether or not the main thread is busy, InvokeAndWait blocks and shares static state across callers_exit after results are written: teardown crashes in static destructors, and Cycles and RhinoCode threads hang a normal returnHeadless Rhino for Mac behaves in ways tests meet:
RhinoDoc.Create included, and headless documents raise no RhinoDoc eventsPlugIn.LoadPlugIn(<path>) registers the plug-in in the user's Rhino profile for later sessions, PlugIn.LoadPlugIn(<guid>) loads an installed oneCould not find <assembly> and 3DconnexionNavlib lines that change nothingEach boot writes Rhino's profile under HOME: cloned settings-*.xml, RhinoCycles, RhinoCode, and Grasshopper 2 logs, and on first boot template files, Grasshopper 2 resources, and plug-in install scans. The host keeps every run off the user's profile:
Main copies McNeel/RegInfo.json, License Manager, and keypairs of the user's Rhinoceros/<major>.0 into a temporary HOME, sets HOME and CFFIXED_USER_HOME, and deletes the folder after the runkeypairs decrypts the cached Cloud Zoo lease, and a profile lacking it deadlocks boot in GetCloudZooLease on the main threadcfprefsd ignores both, and the background library moves the host process's domain and com.mcneel.rhinoceros domains into the scratch profileBackground.m, injected through DYLD_INSERT_LIBRARIES) keeps windows unordered and activation prohibited, and Rhino never takes focusDisplayPipeline draw events stay silent, a view redraw leaves nothing a test reads, and CaptureToBitmap renders on its ownNSAlert.runModal and runModalForWindow: with abort and logs their text to RHINO_TEST_ALERTS, and the host fails the test that raised one--timeout and hang dumps, and a boot stuck in licensing fails every testTemplate project holds every setting below:
| [INDEX] | [SETTING] | [VALUE] | [EFFECT] |
|---|---|---|---|
| [01] | RhinoCommon, Grasshopper, Grasshopper2 | ExcludeAssets="runtime" | Compile against packages, load installed copies |
| [02] | RhinoVersion property | RhinoCommon pin | Package rows, Rhino path, runtime, license seed |
| [03] | TargetFrameworks, EnableWindowsTargeting | net10.0;net10.0-windows | Rhino 9's runtime, both built on every OS |
| [04] | Compile Remove per framework | Windows.cs, Darwin.cs | One boot file and its references compile per framework |
| [05] | IsTestProject, IsTestingPlatformApplication | false off framework's OS | net10.0 tests on macOS, -windows on Windows |
| [06] | XunitAutoGeneratedEntryPoint | false | Host's own Main |
| [07] | GenerateSelfRegisteredExtensions | true | SelfRegisteredExtensions.AddSelfRegisteredExtensions |
| [08] | AllowUnsafeBlocks | true | LibraryImport generator, function pointers |
| [09] | Configurations, RhinoMode option | Interface;Headless;Debug | Interface default and in Debug, Headless in CI |
| [10] | RuntimeEnvironmentVariable | DYLD_INSERT_LIBRARIES | Background library loaded into every macOS test run |
| [11] | TestingPlatformCommandLineArguments | TRX per run, hang, crash dump | Options every run but Debug starts with |
| [12] | CsCheck, CsCheck_Threads | 1 | Property samples on one thread |
| [13] | RunCommand, RunArguments | Rhino's host, exec <dll> | Tests run on the runtime Rhino uses |
RhinoApplication names Rhino <major>.app on macOS and CoreDllPath under HKLM\SOFTWARE\McNeel\Rhinoceros\<major>.0\Install on WindowsResolveRhinoApplication runs in every build and before ComputeRunArguments, and fails a build or run missing Rhino or its runtimeResolveRhinoApplication drops copy-local assemblies Rhino ships, so build output depends on the installBuildBackground compiles Background.m with xcrun clang -dynamiclib beside the test assembly on macOSExcludeAssets="runtime" keeps every Rhino assembly out of build output, a copied RhinoCommon loads beside Rhino's and breaks type identityResolver.Initialize() of Rhino.Inside finds Rhino by its own major through HKLM\SOFTWARE\McNeel\Rhinoceros\<major>.0\InstallSystem, System\netcore, and Plug-ins\Grasshopper alone, and Grasshopper 2 sits in Plug-ins\Grasshopper2\net8.0Main resolves the rest from each .NET folder under Plug-ins (net*.*, never net48), as xUnit discovery loads exported types before bootMain starts the test framework on a worker, and on the boot request constructs RhinoCore on the main thread (NoWindow by default, Hidden for mode Interface)RhinoCore.DoEvents() and Eto with Application.Instance.RunIteration() until tests finish, and end with TerminateProcess, as native teardown calls into a stopped runtimeDoEvents dispatches messages only while a Rhino window is active, none under NoWindow, so Eto InvokeAsync and SwitchToMainThreadAsync wait forever without RunIterationInstallLocation under HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\<arch> (32-bit view) for the OS architectureRHINO_TOKEN alone, and Windows desktops through the signed-in accountTests prove the code under test decides correctly, RhinoCommon's own behavior is McNeel's to test:
Interpolate(I, R(θ), t) ≈ R(tθ)), end points alone pass a constant or nearest-end implementationnull, Guid.Empty, an error message) when the code reports failure that waytrue from the writeModelAbsoluteTolerance and ModelAngleToleranceRadians for documents, the subject's argument for geometry1e-9 fails large models and hides small defectsRhinoMath.ZeroTolerance and RhinoMath.SqrtEpsilon bound floating error of exact arithmetic, never modeling tolerance0.001), arbitrary doubles reach denormals no model holdsVector3d.VectorAngle noise (about 1e-8 rad for near-equal unit vectors)Transform.GetQuaternion returns true with a NaN quaternion for turns at or past about 177.4°, rotations interpolate through Silk.NET.Maths Quaternion<double>Mesh.SolidOrientation reads a cached flag that Flip leaves and DuplicateMesh copies, a flipped result is a new Mesh filled by Append and then flipped, and tests read orientation from face normalsModelUnitSystem on documents a test creates and convert with RhinoMath.UnitScaleRhinoDoc.CreateHeadless(null) or RhinoDoc.OpenHeadless(<file>) inside using, and names it by reference, never through RhinoDoc.ActiveDocBeginUndoRecord and EndUndoRecord around a change, GetUndoRecords proves grouping and Undo proves reversalObjectCount(new ObjectEnumeratorSettings()) counts active objects, Objects.Count counts objects an undo removedAudit after each mutation sequence catches table defects no single object reportsWrite3dmFile with SuppressDialogBoxes and File3dm.Read, into a temporary folder the test deletes.3dm, to the test result through TestContext.Current.AddAttachment.3dm, .gh, .ghz) sits beside the tests with CopyToOutputDirectory and loads from AppContext.BaseDirectoryRuntimeEnvironmentVariable CsCheck_Threads 1), as RhinoCommon and documents are single-threaded[Fact], fix the cause[Fact(Skip = "<reason>", SkipUnless = nameof(<property>))], before any setup runs// --- [GROUP] dividersPlacedSlabsShareOneUndoRecordAndSurviveSave), the failure message names the broken partreferences/ci.md (opens in a new tab)references/grasshopper.md (opens in a new tab)templates/Background.m (opens in a new tab)templates/Darwin.cs (opens in a new tab)templates/GrasshopperTests.cs (opens in a new tab)templates/RhinoTestHost.cs (opens in a new tab)templates/RhinoTests.cs (opens in a new tab)templates/Tests.csproj.template (opens in a new tab)templates/Windows.cs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub bsamiee/rasm --plugin rhino3 skills in this plugin
/debuggingUse when code running inside Rhino on macOS misbehaves and its cause is unproven (wrong value, hang, crash, breakpoint that never stops, refused attach), covering plug-in and Grasshopper 2 attaches, C# and Python 3 scripts, native stops, Rhino-hosted tests, triggers, logs, and re-signing/hostUse when driving a Rhino document, .3dm file, or Grasshopper 2 canvas, or writing C++ against the Rhino SDK, covering background MCP sessions and the C++ SDKOther plugins' skills for the same job