Test Review #2 – ASP.NET MVC Unit Tests

See other reviews:

Here’s the second video review of Unit Tests. This is another one written by Microsoft – ASP.NET MVC (source).

First, it’s important to state how surprised I was by the high quality of the tests in MVC. The tests are readable, maintainable and trustworthy, with very little issues that I could find. whatever Issues I found are rather easy to fix. In any case, if one is looking for examples of systems written in what seems almost entirely in TDD, or at the minimum with very good testing guidance, ASP.NET MVC should be a good stop to look at.

Issues discussed in this video:

  • Implementing RowTest with MSTest, and the importance of naming (14:00)
  • Verify() that is splitted from the mock expectations (17:00)
  • some naming conventions
  • Over-specification in tests (mainly more than one mock object per test)
  • verifying mocks when it’s not required
  • logic inside tests (concatenation)
  • test factory methods with too much logic
  • a very good example of when multiple asserts is really bad (11:50)

Again – I’m very pleased with the test quality. Now is the time to make sure the things above are fixed. they are still important!

Published Saturday, March 21, 2009 11:42 PM by RoyOsherove

Comments

# Test Review #2 ??? ASP.NET MVC Unit Tests - ISerializable - Roy …

Pingback from  Test Review #2 ??? ASP.NET MVC Unit Tests - ISerializable - Roy …

Sunday, March 22, 2009 8:38 AM by Koistya `Navin

# re: Test Review #2 – ASP.NET MVC Unit Tests

Cool. I've been waiting for this thing. Let's see how MS guys write unit tests..

Sunday, March 22, 2009 9:41 AM by DotNetShoutout

# Test Review #2 – ASP.NET MVC Unit Tests - ISerializable - Roy Osherove's Blog

Thank you for submitting this cool story - Trackback from DotNetShoutout

Sunday, March 22, 2009 3:13 PM by Ran Trifon

# re: Test Review #2 – ASP.NET MVC Unit Tests

Hi Roy,

Great posts, I enjoyed seeing your reviews.

Just a little request, can you add a direct link for download the videos. The streaming is very weak here in Israel.

Sunday, March 22, 2009 8:15 PM by Serguei

# re: Test Review #2 – ASP.NET MVC Unit Tests

Thanks Roy,

Are you planning to summarize test reviews part 1 and 2 in a blog post in addition to video? Simple "do's and dont's" with short explanations of why go a long way.

Monday, March 23, 2009 1:58 AM by ISerializable - Roy Osherove's Blog

# Test Review #3 – Unity

Watch previous videos: Test Review #1 – NerdDinner Test Review #2 – ASP.NET MVC     In this

Monday, March 23, 2009 2:23 AM by Community Blogs

# Test Review #3 – Unity

Watch previous videos: Test Review #1 – NerdDinner Test Review #2 – ASP.NET MVC     In this

Monday, March 23, 2009 8:41 AM by Rainer Schuster

# re: Test Review #2 – ASP.NET MVC Unit Tests

The part in the review, where the delegate checks if another one inside the test is called looks very clear to me.

It's a kind of Template Method where the specification later on could be used to write and test the concrete implementation. So the verification states out what the implementer should do to verify the right result.

Monday, March 23, 2009 1:33 PM by Eilon

# re: Test Review #2 – ASP.NET MVC Unit Tests

@ 30:50 in the video - why are we using "98052".

That's the mailing zip code of Microsoft headquarters in Redmond, WA. It's sort of a joke :)

# Great unit tests review by Roy Osherove « Far Away Developer

Pingback from  Great unit tests review by Roy Osherove « Far Away Developer

Monday, March 23, 2009 9:15 PM by zihotki

# re: Test Review #2 – ASP.NET MVC Unit Tests

Thanks for great review. It's very interesting and usable.

Tuesday, March 24, 2009 3:18 AM by Jeff Brown

# re: Test Review #2 – ASP.NET MVC Unit Tests

Nice job, Roy!  This is much better than your first review.  Keep it up.  :-)

I'm going to make my whole team watch this...

Tuesday, March 24, 2009 7:16 AM by ASP.NET MVC Archived Blog Posts, Page 1

# ASP.NET MVC Archived Blog Posts, Page 1

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

Monday, March 30, 2009 3:33 AM by Helper Code

# Test Reviews at ISerializable

It’s hard to start TDD and using Unit Test without a good mentor. Although writing unit tests seems simple

Sunday, April 12, 2009 8:40 PM by John

# re: Test Review #2 – ASP.NET MVC Unit Tests

I like the depressing/hilarious style of reviews 1 and 3 better(the best time to watch them is after 3AM) :D

Using random numbers, instead of 0 or 1, for testing is an advice I've seen in many MS books like www.amazon.com/.../1556155514 . In legacy languages like C and C++(hahaha) it helps find bugs in the manual memory managent.

Sunday, April 26, 2009 9:19 PM by Mark

# re: Test Review #2 – ASP.NET MVC Unit Tests

Nice video.  I picked up a few tips by watching it :)

# Matt Penner » Blog Archive » Roy Osherove’s TDD Code Review Videos

Pingback from  Matt Penner  » Blog Archive   » Roy Osherove’s TDD Code Review Videos

Wednesday, September 02, 2009 11:50 AM by Unit Test Videos « Legalize Adulthood!

# Unit Test Videos « Legalize Adulthood!

Pingback from  Unit Test Videos « Legalize Adulthood!