Saving you some labor in creating your Unit tests...

Now a full on Channel 9 video as well...

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?

Visual Studio Unit Test Generator v1 “lands”

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.

Project Principles

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.

...

Unit Test Generator

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.

image

Right-click in your method to select Generate Unit Test.

image

This generates a test project and a test class—if needed—then adds the references, the namespace, and the test methods.

image

...

From Quick Reference Unit Test Generator Overview.pdf (here's more doc's v1 Unit Test Generator Documentation)

...

You can create additional test methods by repeating the same process within the same method.

Benefits

  • 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.

...

Requirements
 Visual Studio 2012 Professional or higher
 Visual Studio 2013 Professional or higher

...

Happy [save you some] Labor Day!

Tags:

Follow the Discussion

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.