VS11 Gets Better Unit Testing Tools, Fakes Framework
A New Unit Test Explorer, ability to run tests on each build, better Code Coverage tool, support for third party frameworks, a new VS Fakes Framework, better performance and more are all coming together in Visual Studio 11 to provide much better Unit Testing experience for Developers.
We recently reported that VS 11 Beta supports multiple Test Frameworks. While that itself is a significant improvement, there are several other enhancements made to MSUnit as well as Unit testing workflow in Visual Studio in general -
- Better Unit Test Explorer – indicators like the Red Green Bar, Search with Tokens (eg. search only “Failed” Tests), reordering to show failed tests first, links to more failure details like error message and stack trace
- MS-Test Improvements – performance improvements and better handling of more tests, proper support for 64-bit .NET, multi-targeting, Async Unit Testing Support, Native unit testing support
- VS Fakes Framework – Stubs and Shims (run-time method-interceptors). Shims are especially interesting because they allow you to replace any existing method with your own implementation, including base types and methods. You can read more about Shims on MSDN. Mocks are missing, but you can do assertions within the stub method implementations to overcome this in some scenarios.
- Other tooling improvements – simpler Code Coverage (without any setups needed), automatically running tests after each build
There are some more features which aren’t released in VS11 beta, but are still being worked, like better startup performance, grouping and sorting in UT Explorer and more. Peter Provost has written a detailed article covering all these new features.
Incidently, some VS 10 unit testing features have been deprecated-
- Test Lists
- Private Accessors
- Test Impact
- Generate Unit Test Wizard
Legacy tests using these features will still work in VS 11 but you will not be able to create new tests using these. These have been cut mainly due to either poor experience or performance reasons. Some of these may be replaced with better alternatives in the final release of VS 11.
Delivering Performance Under Schedule and Resource Pressure: Lessons Learned at Google and Microsoft
Ivan Filho Mar 06, 2014