Friday, February 28, 2014

Ignoring unit tests for a specified timeframe

A coworker and I were talking about an issue we were having with a test. We wanted to turn the test off for a few hours while we pushed code through our valuestream, and later go back and fix the test. Sometimes you just have to get code out, regardless of the risk.

We ended up adding the IgnoreAttribute to the test, got the code deployed, and immediately fixed the test.

I would really like an extension of the IgnoreAttribute, but for a specified time. Something like [IgnoreUntil(datetime)], or [Snooze(datetime)].

I took a look at the IgnoreAttribute for MSTest, and of course, it is sealed. An interesting idea hit a dead end. Why is it sealed? Why can I not extend this attribute and add this functionality to MSTest.exe?

One of my biggest complaints about the .Net framework and tool-set is how these areas of functionality are not following the open closed principles.

Maybe it is time to move over to another test framework. Any suggestions?