Yet another reason to love TestDriven.net

As I was coding some new tests for the container integration part of OpenRasta (which, since beta 2 changes, has become much more complicated…), I discovered a feature I didn’t even realize was there.

I use abstract test classes so that each container that OpenRasta supports automatically gains any new tests that verify the behaviour of the container matches OR’s expectations. In an abstract test, the test class that contains the test is marked abstract, and you inherit from that class for each specific set of tests you can run. I’ve used that trick for a long time, and was one of the main reasons why I didn’t like MSTest much, as it seems the guys in Redmond didn’t support that scenario.

So here I was, coding away in an abstract class, and frenetically executing the test as I added code (something I remapped to Ctrl+T, T). Then it dawned on me that I was attempting to execute the abstract class. But surely, an abstract class can’t be instantiated I told myself.

And then I realized what was happening. TD.net was simply executing the concrete classes inheriting from my test class. Sweet.

PS: I have no idea if it’s the runner or nunit, and have no idea either if other runners will or won’t execute this scenario. It just works and that makes me happy :)

Ads

Comment