NCrunch is a great unit test runner and has been part of my developer toolbox for many years.
Recently I was having an issue on a medium-sized project where the NCrunch’s Build step was taking almost 2 minutes to complete. That spinning “B” was taking forever!
The tests themselves would run in under one minute.
The problem was we use a custom Autofixture [AutoData] attribute on every test.
Our attribute’s constructor creates a TestServer for running the web tests against.
We then inject the test server into each test, i.e.
[Scenario] [WebHostAutoData] public void CreateJob_ShouldCreateSuccessfully( WebApiClientFixture apiFixture
As it turns out, NCrunch enumerates all test attributes during Analysis, so you should not have any expensive code in your attribute’s constructor.
In my case, I fixed this by introducing a base class for all of my tests, which creates the TestServer (during test run). I then dropped our custom [AutoData] attribute.