Wednesday, October 22, 2008

Poor Man's Coverage

If you havn't time to bake in a coverage tool to your build, you could just inspect your types and fail if any don't have an associated test.

This was our type exclusion list:

!t.Name.Contains("Test")
&& !t.Name.Contains("Stub")
&& !t.Name.Contains("Spec")
&& !t.IsInterface
&& t.IsClass
&& t.IsPublic
&& !t.ContainsGenericParameters
&& !t.IsNested
&& !t.IsAbstract
&& !t.IsSealed
&& !t.IsSerializable
&& !t.IsSubclassOf(typeof(Attribute))
&& t.GetCustomAttributes(typeof(GeneratedCodeAttribute), true).Length == 0


It's not comprehensive, but all you need is a nudge now and again to remind you to follow the right path.

No comments: