Wednesday, January 08, 2014

Faking it gets a little better... the "Better Unit Testing with Microsoft Fakes" eBook that is...

Willy's Reflections - Better Unit Testing with Microsoft Fakes – eBook update v1.2 posted

Thanks to Michael Fourie, we have been able to action the backlog of community feedback for recent versions and package as part of the v1.2 eBook update.

Where can I get the new stuff?


Visual Studio Test Tooling Guides - v1.2 - Better Unit Testing with Microsoft Fakes

Release Notes

Welcome to the Better Unit Testing with Microsoft Fakes eBook
Quality-Bar Details

  • Documentation has been reviewed by Visual Studio ALM Rangers
  • Documentation has been through an independent technical review (UE)
  • All critical bugs have been resolved
Known Issues / Bugs
  • EPUB and MOBI downloads are still v1.0 and we have no plans to upgrade to v1.2.
  • Also available in Spanish!


For modern development teams, the value of effective and efficient unit testing is something everyone can agree on. Fast, reliable, automated tests that enable developers to verify that their code does what they think it should, add significantly to overall code quality. Creating good, effective unit tests is harder than it seems though. A good unit test is like a good scientific experiment: it isolates as many variables as possible (these are called control variables) and then validates or rejects a specific hypothesis about what happens when the one variable (the independent variable) changes.

Creating code that allows for this kind of isolation puts strain on the design, idioms, and patterns used by developers. In some cases, the code is designed so that isolating one component from another is easy. However, in most other cases, achieving this isolation is very difficult. Often, it’s so difficult that, for many developers, it is unachievable.

First included in Visual Studio 2012, Microsoft Fakes helps you — our developers — cross this gap. It makes it easier and faster to create well-isolated unit tests when you do have systems that are “testable,” letting you focus on writing good tests and not on test plumbing. It also enables you to isolate and test code that is not traditionally easy to test, by using a technology called Shims. Shims use runtime interception to let you detour around challenging dependencies and replace them with something you can control. As we have mentioned, being able to create this control variable is imperative when creating high-quality, fast-running unit tests.

Shims provide a very powerful capability that will let you circumvent all kinds of roadblocks when unit testing your code. As with all powerful tools, there are a number of patterns, techniques and other “gotchas” that can take time to learn. This guidance document provides you with a jump-start on acquiring that knowledge by sharing a large number of examples and techniques for effectively using Microsoft Fakes in your projects.

We are happy to introduce this excellent guidance document produced by the Visual Studio ALM Rangers. We are sure that it will help you and your team realize the power and capabilities Microsoft Fakes provides you in creating better unit tests and better code.

A good book if you're looking for information about using the mocking/isolation framework from Microsoft, Microsoft Fakes.


Related Past Post XRef:
Faking it in VS11 - Moles, the Microsoft mocking/isolation framework, is baked into VS11

Interested in PEX & MOLES? Wish you could go to a five hour workshop on them? Here’s the next best thing…
Think you can’t unit test ASP.Net? Here’s a tutorial for one way, using the power of Pex and Moles


Terry Aney said...

Aren't Fakes only allowed in VS Ultimate?

Greg Duncan said...

Visual Studio Ultimate or Premium,