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!