Month: December 2016
Creating a custom xUnit [Trait]
After creating my blog posts on writing tests with xUnit in a TDD fashion, I remembered I had only briefly touched upon Trait
s and not at all how to implement custom ones. Time to remedy that.
Do I know or did I just take a decision
A while ago, the team asked who took the decision to use a certain pattern on how a custom configuration was implemented. As that happened weeks or even months ago, nobody could remember taking that decision. That got me thinking about when I take a decision versus when I know something for certain.
Tests ran multiple times on the CI server
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.