Hello,
I’m trying to test a Rhino plugin
some of the objects that I need to interact with must be created in the plugin in order to be valid
so I wanted to be able to unit test the rhino plugin directly
we use Rhino.Testing to handle some of our unit tests
is there a way to interact with our plugin objects?
I tried to include my plugin project in a testing project using Rhino.Testing but that appears to crash the testing framework
I created an empty wpf plugin to see if I could recreate it
and it fails with this message
========== Starting test discovery ==========
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process for source(s) 'C:\RhinoExamples\EmptyPluginForTesting\SampleTestProject\bin\Debug\net7.0-windows\SampleTestProject.dll' exited with error: Failed to create CoreCLR, HRESULT: 0x80070057
. Please check the diagnostic logs for more information.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ThrowOnTestHostExited(IEnumerable`1 sources, Boolean testHostExited) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 520
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 294
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.InitializeDiscovery(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler, Boolean skipDefaultAdapters) in /_/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs:line 149
========== Test discovery aborted: 0 Tests found in 84.3 ms ==========
this is my setup fixture
namespace SampleTestProject
{
[SetUpFixture]
public class SetupFixture : RhinoSetupFixture
{
public override void OneTimeSetup()
{
var rhinoDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\McNeel\Rhinoceros\8.0\Install", "Path", null) as string ?? string.Empty;
var plugin =
"C:\\RhinoExamples\\EmptyPluginForTesting\\EmptyPluginForTesting\\bin\\Debug\\net7.0-windows\\EmptyPluginForTesting.rhp";
plugin = plugin.Trim('"');
Assert.True(Directory.Exists(rhinoDir), string.Format("Rhino system dir not found: {0}", rhinoDir));
Assert.True(File.Exists(plugin), string.Format("Rhino plugin file not found: {0}", plugin));
var xml = $@"<?xml version=""1.0"" encoding=""utf-8""?>
<Settings>
<RhinoSystemDirectory>{rhinoDir}</RhinoSystemDirectory>
</Settings>
<LoadPlugins>
<Plugin Location=""{plugin}""/>
</LoadPlugins>
";
File.WriteAllText("Rhino.Testing.Configs.xml", xml);
base.OneTimeSetup();
}
public override void OneTimeTearDown()
{
base.OneTimeTearDown();
}
}
}
and this is the sample test I was trying to run
using NUnit.Framework;
namespace SampleTestProject
{
[TestFixture]
public class TestFile : Rhino.Testing.Fixtures.RhinoTestFixture
{
[Test]
public void TestCircle()
{
Assert.True(true);
}
}
}
Is there some other way I’m missing to unit test a plugin directly?