Carl
Carl

Reputation: 1832

AutoFixture AutoMoqData gets slow as more tests are added

Using nunit 2.6.4 and AutoMoqData the Resharper runner appears to be evaluating all of the parameters to be passed into all tests prior to executing a single test, even if all I want to do is run a single test/small suite of tests. Right now (we have 1000's of tests) it's taking 2-3 minutes to run a single test, which doesn't work for TDD.

I tried switching to Xunit to see if nunit was the issue and there was still a big delay before running the first test.

Is this behaviour to be expected? Or are we doing something wrong?

Upvotes: 2

Views: 1481

Answers (1)

Carl
Carl

Reputation: 1832

So the results of my investigation are that when nunit discovers the tests it runs through the attributes and creates the objects, and nunit (2) discovers all the tests, even if you are only interested in running 1. Apparently this will change at some point for nunit 3.

The complicated and large object graph was the reason that the tests were slowing down, and by customising Autofixture to brutally prune this graph the tests are now much much (260s - 8s) faster.

I tried using Autofixture.AutoEntityFramework, but although it was doing what I wanted it to do, the speed gains were not enough to effectively TDD (260s - about 100s).

Upvotes: 1

Related Questions