Suddenly, NUnit stopped working. We were in the middle of our refactoring, moved code around and ended up with all our tests being ignored. We rebuild the solution – no errors detected. We run our application – no problems at all. We even rebooted the machine. Everything worked except our tests:
There was a little error icon in the test runner and when we clicked on that, it showed us this message:
The error message didn’t help us much in finding the source of the problem. We had to go the hard way and look at the changes we did since the last commit.
The solution
We used Git to show us all changed files and we checked every change we made. It took time, but we found the problem: our App.config got two sections of <appSettings>
:
We merged the two sections, removed the no longer needed one and run our tests again. Now they are all green and everything works.
Fix the problem, not the symptom
We could have stopped there and continued with writing tests. Instead, we asked our self why this problem happened in the first place. I expected the <appSettings>
-section below the connection strings, my team mate at the end. That different set of expectations let us to create a second section and cost us a lot of time.
To prevent this from happening again, we decided to harmonise the order. We had to spend even more time to update all App.config files, but now everything is at the same place and such problems should be a thing of the past.