Test cases are not running when trying to run together-GH plugin-Xunit

I am using the XUnit framework to write unit test cases for my Grasshopper plugin. When I run the test cases individually, they execute properly. However, when I try to run them together, most of the test cases fall into the category of “Not Run.” I am using the RhinoDoc.CreateHeadless() method to create a few objects and initialize RhinoDoc.ActiveDoc, as my project fetches data from ActiveDoc.
I am disposing RhinoDoc.ActiveDoc properly after each method .
Additionally, when running all the test cases together, some fail with the error:

" System.AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

The error occurs on the line RhinoDoc.CreateHeadless() .

1 Like

There’s a few possibilities for why this is;

  • Are you running the tests in parallel? (I believe xunit is configured to do this by default)
  • Are you running the tests on multiple cores? (The Rhino app is single threaded)

This page should provide some more info

If this doesn’t help if you could provide some code samples that would allow me to provide more insight :slight_smile:

1 Like

Where you able to solve this? Because I’m experiencing the same thing.

We have some tools to help with testing with Rhino. See this post: Automated testing with Rhino ✅

1 Like