Saving you some labor in creating your Unit tests...
- Posted: Sep 02, 2013 at 6:00AM
- 15,987 views
Today in the US we are celebrating Labor Day so I thought a post that might save you so labor kind of fitting (okay, maybe I'm reaching a little bit, but hey, I tried!)
Unit testing is good, right?
How about bringing back Right-Click Create Unit Tests to VS2012? In such a way that it supports not only MSTest, but XUnit and NUnit too?
The ALM Rangers are pleased to announce the landing of the Visual Studio Unit Test Generator v1.
Looking for unit test code generation?
The Visual Studio Unit Test Generator helps to increase developer productivity by decreasing the setup work involved in creating new unit tests. It takes away the routine test creation tasks allowing a developer to focus on the highest value, writing the test itself.
Visual Studio Unit Test Generator provides the ability to generate and configure a test project, test class, and test stub to enable you to get to write your test sooner. It provides a set of configuration options that allow you to tailor the generation to match your naming and organization schemes. It is also fully configurable to support MSTest, XUnit, and NUnit so that you can choose the framework that is most suitable in your environment.
The team embraced the following principles when they designed and developed the extension:
- Achieves a moderate amount of restoration of Visual Studio 2010 feature functionality.
- Replaces and does not resurrect the old feature.
- Supports .NET MS-Test, NUnit and XUnit Test Frameworks and generation of VB/C# test code.
- Presents a "reference implementation" of how to do this for a particular test framework.
- Provides a basic infrastructure and an extension point.
- It focuses on project and reference management and not on code generation.
The Visual Studio ALM Rangers accelerate the adoption of Visual Studio with out-of-band solutions for feature gaps and value-add guidance for the ALM community.
Once installed, you will find the extension under Extensions and Updates in the Tools menu.
Right-click in your method to select Generate Unit Test.
This generates a test project and a test class—if needed—then adds the references, the namespace, and the test methods.
You can create additional test methods by repeating the same process within the same method.
- Quickly get to writing test code, not having to worry about setting up projects and files.
- Customize the unit test code generation using a context menu, ensuring that generated tests better match your naming schemes.
- Generate unit test stubs against multiple frameworks so that you can use any framework you like.
Visual Studio 2012 Professional or higher
Visual Studio 2013 Professional or higher
Happy [save you some] Labor Day!