19 Dec
2007

But the tests passed on my machine…

I checked in some code earlier today. Naturally I had successfully run all of the unit tests locally first. Nevertheless the CI build still failed. Luckily I had faced this problem before and after some initial frustration I quickly figured out the cause. Here are a couple of tips to help you if you face the same situation:

  1. If you use R# remember that it does necessarily run tests in the same order as NUnit. So running the tests in NUnit is a good starting point, Obviously the order in which tests are run should not be important. That brings us to #2…
  2. The problem is not always caused by the test or even test fixture that fails. If the test runs individually but fails as part of the entire suite then look to the previous test. In my case the previous test’s class did not inherit from AbstractRepositoryTest (a bases class which is similar to Roy’s Abstract Utility Class) and hence some previous work was not being cleaned up properly.

2 thoughts on “But the tests passed on my machine…

  1. I usually use some transaction mechanism to rollback any changes previous tests have done, during the teardown process. Are you using any such mechanisms?

  2. Yes but as I indicated in #2 I rely on inheritance to achieve this but the class that actually caused the problem did not inherit from anything. Of course the fix was simply to inherit from the correct base class.

Comments are closed.