Great video Roy!
Do you know any open source .net projects which have
really good unit and integration tests?
My opinion on using var in tests is that it should only
be used if the type is 100% clear (such as var myType =
new MyType() ) or if the type is non-important to the
operation it is being used in (such as foreach var v in
Type).
If you are testing an object of a certain type that is
instantiated in a method call you should declare it as
that type for this reason: If a type can be cast to many
different types and its instantiation comes from a
method call, how can you be sure of the type you are
then testing? I think this is also a case where you
don't want the refactor friendly behavior of var. The
type of the actual object under test should not change
silently via rafactoring IMHO. If the method call is
refactored to return a different, but compatible type, I
think the test should break.
What is the point of these video's Roy? If its public
ridicule your spot on. Otherwise you need to work on
displaying your professionalism. Did you need to sink to
a WTF level in the video?
If your goal is to help people learn/improve their tests
then highlight an issue and show them how to fix it.
Great review, a bit on the long side though. Amazing
what you can find in a test suite. Makes me think harder
at cleaning up my tests.
@Aaron Fisher: I aggree, I think it would be very useful
if you showed more how to fix the problems that you
highlight. Not everyone has read your book ;)
I agree with some of the other comments that it would
have been more instructive on how to improve some of the
tests. However, given that this was recorded very early
in the morning and likely on impulse; I can fault the
content too much :)
Thanks again for a great review. Each one helps me to
reaffirm the stuff I learned from your book (which I
bought based on reviews on Amazon rather than by looking
at the illegally distro-ed copy of your book online.).
I'm reading it in tandem with 'working effectively with
legacy code - Michael Feathers' and I find they
complement each other very well.
More specifically about this Test Review I would also
like to see you refactor some (definitely not all - as
the number of tests you cover is important too) of the
tests as well.
Cool stuff Roy, great screencast. We are looking into it
and may refactor things a bit - time permitting.