Tests ran multiple times on the CI server


1 min read

A while ago, colleagues and I encountered strange behaviour on our Continuous Integration server: several tests were run twice.

The problem was caused by a test project that was referenced in another test project because of some infrastructure code that was reused. Probably a Visual Studio or ReSharper suggestion of "Would you like to reference ClassX from Project.Y" and somebody just clicked "accept" or maybe even ReSharpers auto resolve all references of pasted code. This caused a test assembly to be loaded twice and thus the tests were discovered twice. Assemblies should not be carelessly referenced.

We solved it by putting all general purpose infrastructure code into a separate assembly that can be safely referenced throughout all the test projects. Case closed.