Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TDD with large C# solution virtually impossible due to slow compile speed

I am working on a large solution with currently 60 assemblies. There are many assemblies that define common parts for the solution, and then a few entry point assemblies to the system.

TDD is virtually impossible at the moment, as a single line change in the lowest domain layer, forces a rebuild of nearly the entire solution, as the test assembly references various layers of the solution.

What is best practice, to bring the build time down from its current 75seconds to a more acceptable 5 seconds or so? This will make TDD feasible again.

When doing unit tests, some classes require mocks defined by interfaces from other assemblies, and as such have to be referenced in the test assembly. So having a single reference to the other assemblies is not always possible, except at the lowest level of the solution.

like image 999
Hendrik Avatar asked Feb 17 '11 12:02

Hendrik


1 Answers

IMHO the problem lies here: "as the test assembly references various layers of the solution."
You should have one test assembly per assembly you want to test.
When you still reference many assemblies in each of your test assemblies, you have a different problem: You are creating integration tests. That's not what you want to do in TDD.

In addition to the update to your question:
Normally, you would define the interfaces in another assembly than the implementation. So a change to the implementation of a low level class should have no impact on the higher level classes that use those interfaces...

like image 124
Daniel Hilgarth Avatar answered Oct 15 '22 20:10

Daniel Hilgarth