>XUnit.Net’s [Fact] and [Theory] attributes


Following a debate with Dave yesterday I got to thinking (it’s a rare event, and I like to revel in it when it happens). There may be technical reasons why you have to use [Fact] for a “regular” unit test (oh, I know it’s not a unit test, it’s a specification, humour me) and [Theory] for “data driven” tests. But from a usage point of view, why should I care if it’s data driven or not? Wouldn’t it be nice if the test runner would be able to identify a parameterless method and say “hey, this must be a regular unit test”. Also,if the method has parameters it could be smart enough to say “hmm… this must be a data driven test. Do I have any data available?”. If the developer hasn’t provided any data, then the test, I mean spec, fails.

I think I fall on Dave’s side of the argument that this feels like changing somewhat standardized terminology just for the sake of being different (or maybe it’s trendy to keep up with the Ruby folks?).

What do you think, dear reader?


3 thoughts on “>XUnit.Net’s [Fact] and [Theory] attributes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s