Unit Test Generator


Generates unit test code for methods in classes under test.

(38) Review
Visual Studio
2013, 2012
Download (63,468)
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Reviews (38)
Q and A (39)
Sign in to write a review
Sort by:

by Grant Duan | September 02 2014

it's usefull

by kjbartel | August 15 2014

Very useful extension not only adding back functionality which had been removed but also extending the functionality by adding in support for different testing frameworks. The biggest problem however is that it doesn't support generating tests for internal classes and methods. It should be rather trivial for this to be fixed and an InternalsVisibileTo attribue added to AssemblyInfo. Once that's been done then I'll give it 5 stars.

by RingDotNet | July 15 2014


Finally something to replace the functionality that was removed from VS.
It does exactly what I need it to do. I installed it through VS's "Extensions and Updates" wizard and had no problems.
IMHO it works better than what was taken out of VS.

Thanks Guys for providing this functionality through an extension. I'll use it a lot.

by immeraufdemhund | May 21 2014

This simple tool makes adding unit tests for my classes a breeze. Especially when I am implementing a interface. Just create my class, implement the interface classes. Right click and generate all my tests.. then start knocking out my methods one by one good old TDD style. I love it. Great tool. I would how ever like to see something like Netbeans and IntelliJ to when generating tests in that they make a instance, a actual, and a expected variable for me. Granted it's not always right, but it's nice to have the majority of that put in. Just a thought.

by BlogTroll | May 07 2014

Does exactly what it promises, setting up the plumbing and creating one test method, or a test method for EVERY public methods of a public class. Obviously not the same as the discontinued feature, but then it states that clearly. It obviously assumes that you have reviewed the blog posts and documentation listed with the extension.

by Ojemzy | April 30 2014

Erm doesnt work at least on Express 2013.. 1 hr of trying.

Cant even upload image of pop-up error.

30/04/2014 20:27:24 - Searching for applicable products...
30/04/2014 20:27:24 - Found installed product - Microsoft Visual Studio 2010 Premium
30/04/2014 20:27:24 - Found installed product - Microsoft Visual Studio Express 2013 for Web
30/04/2014 20:27:24 - Found installed product - Global Location
30/04/2014 20:27:24 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.InitializeInstall()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

Visual Studio ALM Rangers May 20 2014
| Edit |

As outlined in the release notes and documentation you require Professional or higher. Express is not supported.

by Bala Subra | April 24 2014

Must have in every dev env

by GBotros | April 16 2014

by Micky D | April 15 2014

Works exactly as described. Compatible with Resharper

by smarty420 | April 03 2014

People who ever developed this plugin ,please don't call yourself a programmer. This is a useless tool that does nothing . Its a shame on MS , that they can't get a back cool feature that is needed by its developer community , even after two releases of visual studio.

by Bgardner21 | March 20 2014

It would be really nice if it picked up on the InternalsVisibleTo setting, and allow you to create unit tests for internal classes in the project. Aside from that, it works well.

by bsolomon | March 20 2014

Better than nothing. All the positive ratings here must be from those
who do not know or remember the vs2010 version.

The original version would create test cases with a template call to
the method under test, AND would also allow you to create test cases
(with calling stubs) for EVERY method in a class, not just one at a time.

by AAAZ | March 09 2014


Who's idea was to remove from VS 2013 "Create Unit Test"?

This solves nothing. It does not create the auto code generated that
we enjoyed on VS 2010,12

VS 2013 Testing features has gone back in time 10 years.

by Atrejoe | March 05 2014

Thanks for restoring this functionality to Visual Studio!
Nice to haves:
- Register keyboard shortcut upon instllation, like ctrl-U(nit)-T(est)
- Add Xml comments to generated code.

by Grynchuk Anatolii | February 24 2014

bull shit :(. No comments... Just do nothing.

by TheBigFont | February 13 2014

Easy to use out of the box.

by D. Oliana | February 11 2014

by cml1 | February 01 2014

Error "Controller must have testable element property set up" when try to generate test for method in struct.
(Ugly workaround: change "struct" to "class", generate test, change to "struct" ;)

by ImadMN | January 28 2014

It has a bug when creating a test class in a C# project from a VB class.
Can you solve it, please ?

by Anatolii Grynchuk | January 09 2014

Unnecessary tool whith generating body like Assert.Faile or empty. Actually this tool does nothing for now. Whould be better to generate a method like



Assert.Fail("Not implemented");

1 - 20 of 38 Items   
Sign in to start a discussion

  • In 2010 in generated
    1 Posts | Last post Thu 5:41 PM
    • I don't find this tool that useful if it doesn't autofill the params for the method it is testing. Also, it should make assumptions on what you will asset. If the method returns a bool assert that the response should be true. If it should be false that is a small change the developer can make.
      This is a small step up from copying and pasting an existing test method and renaming it. Please consider adding the auto-gen that 2010 had. At minimum for VSTest.
      Thank you.
  • You know what would be cool?
    2 Posts | Last post September 09, 2014
    • T4 template generation option.   I would like to reference a code generator for templating my unit tests.   
    • Add... doesn't have menu items.  I have the "Configure Unit Test Generation..." menu item under test, but I am unable to create a project where I can right click on ANYTHING in it and get the options to generate my tests... this worked in previous versions...
      Microsoft Visual Studio Premium 2013
      Version 12.0.30501.00 Update 2
      Microsoft .NET Framework
      Version 4.5.51641
      Installed Version: Premium
      LightSwitch for Visual Studio 2013   06191-004-0454001-02566
      Microsoft LightSwitch for Visual Studio 2013
      Office Developer Tools - May 2014 Update ENU   06191-004-0454001-02566
      Microsoft Office Developer Tools for Visual Studio 2013 - May 2014 Update ENU
      Team Explorer for Visual Studio 2013   06191-004-0454001-02566
      Microsoft Team Explorer for Visual Studio 2013
      Visual Basic 2013   06191-004-0454001-02566
      Microsoft Visual Basic 2013
      Visual C# 2013   06191-004-0454001-02566
      Microsoft Visual C# 2013
      Visual C++ 2013   06191-004-0454001-02566
      Microsoft Visual C++ 2013
      Visual F# 2013   06191-004-0454001-02566
      Microsoft Visual F# 2013
      Visual Studio 2013 Code Analysis Spell Checker   06191-004-0454001-02566
      Microsoft® Visual Studio® 2013 Code Analysis Spell Checker
      Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.
      The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.
      Windows Phone SDK 8.0 - ENU   06191-004-0454001-02566
      Windows Phone SDK 8.0 - ENU
      ASP.NET and Web Tools   2013.2.50425
      Microsoft Web Developer Tools contains the following components:
      Support for creating and opening ASP.NET web projects
      Browser Link: A communication channel between Visual Studio and browsers
      Editor extensions for HTML, CSS, and JavaScript
      Page Inspector: Inspection tool for ASP.NET web projects
      Scaffolding: A framework for building and running code 
  • Generate Unit Test Output Project not recognized
    1 Posts | Last post August 28, 2014
    • Hi,
        I have upgraded extension for few times and every time I upgrade I loose "connection" to my output projects in solution. So I can't pick from my existing unit test projects but I have to create a new one and then move the generated file to proper project.
      Did anyone has this issue or any kind of workarounds ?
  • So non-public methods are always perfect?
    1 Posts | Last post August 17, 2014
    • Add me to the increasingly massive list of people to ignore who are asking to test non-public methods. It would be nice to not have to find-replace everything with "public" just to work around your dogma.
      Seriously, at least provide a reason for this.
  • Generating unit test for private method
    1 Posts | Last post August 08, 2014
    • Could you add support for private methods?
      Currently I change my private methods to public, generate a unit test and make the method private again.
      Then through reflection I invoke the private method. More info here: http://stackoverflow.com/questions/135443/how-do-i-use-reflection-to-invoke-a-private-method
      This should be doable to implement in this tool?
  • Generate Unit Tests of Internal Methods
    1 Posts | Last post August 07, 2014
    • Hi. 
      I am using your tool since a month and I am really happy about it! We have just started to generate Unit Tests of some Internal Methods (with the assembly info adapted):
      [assembly: InternalsVisibleTo("ProjectTests, PublicKey=0123456789...")]
      in C# and we have found out that your shortcut does not appear.
      Thanks in advance. Best regards,
  • Doesn't work with interface implementations?
    3 Posts | Last post July 24, 2014
    • I'm not seeing any menu item to generate tests when clicking on methods explicitly generated from an interface.  Is this because they are not "public"?  My goal was to create mocks around interfaces and then test them in isolation. 
      Am I missing something?
    • Just installed... same issue. 2013 Premium as well. I have used this successfully with past versions. Sure hope someone replies with a way to check this install.
      I don't see anything to configure and no Generate Unit Test option anywhere.
      I am using Public methods and still don't see anything. Tried reinstalling, still nothing.
      Help guys... please.
    • I got it working... oddly. The class I was trying to generate from was Public WCF as was the Method. However it inherited from an Interface. Have no idea why this would not work.
      I dropped out of that project, created a dummy test class and method. This enabled the Generate Unit Test options. Then I was able to go right back to the original class and it works.
      I guess it just needed to be initialized in a simple class first. Maybe this isn't a fix, but its working.
  • installed - in tools, but no generate unit test
    4 Posts | Last post July 22, 2014
    • I have VS2013 ultimate, tools/extension show I have installed, and under Test I have Configure Unit Test Generator, but no Generate Unit Test shows when I right click on class or methods. Ideas ?  I have VS 2012 installed with same issue. Is there any other way to invoke it ?? What next ?
    • After I built the project then the Generate showed up... not sure if a build is prerequisite to getting the generate enabled...
    • Is your class and the method of focus public?
    • I have a similar problem, and my class is internal. When I change the class to public, the "Generate Unit Test" menu option appears.
      Unfortunately, almost all of our classes are internal and I've always just added an InternalsVisibleTo attribute in the AssemblyInfo.
      Is there anyway to get this extension to work on internal classes?
  • Corrupt Visual Studio 2013 Update 2
    1 Posts | Last post June 16, 2014
    • After I installed "Unit test Generator" on my Visual Studio Premium 2013 Update 2, it corrupted all my projects...
      1) First thing that happen is none of my projects can be loaded. For all "csproj", it says "Application is not installed".
      Un-install / re-install the extension does not solve issue.
      I eventually solved the problem by running devenv /ResetSkipPkgs
      I can also recreate this problem by installing the "Unit Test Generator" again.
      2) Second problem I cannot resolve myself, when I try to create a view in MVC project, I got the error:
      There was an error running the selected Code Generator:
      "No Exports were found that match the constraint:
      I can still create Controllers, class etc... when I tried created a view, it's the problem...
      Anyone know how to fix this error? I tried devenv /ResetSettings or /resetuserdata, none of that works...
      Any idea? Thanks.
  • please help with how it mangles project references
    7 Posts | Last post May 28, 2014
    • Hi Folks
      My background is mostly JUnit and NUnit (but my current employer wants folks to start using MS Test).
      I've been going a little nuts today with the Microsoft Testing Framework, let me explain:
      1. Had (MS) unit testing already running just fine (but all was included in the same project MyProject)
      2. I wanted to split this out into it's own MyProjectTests for MyProject (which I thought would be all of a 5 minute process, and keep projects in the same solution)
      3. Upon right-clicking and generating test stubs for classes in MyProject and into MyProjectTest, Visual Studio 2013 took a FULL crash with a disk space err (which makes little or no sense, since I had 519 GB available)
      4. It took me about an hour to fix manifest issues and bizarre stuff (like "ambiguous reference(s) to abc extension" where there was only 1 copy in the project <- renaming these fixed those issues in the proj manifest)
      OK, so now I have:
      namespace InternalTools.MyProject (for MyProject) which I'm trying to call classes from namespace InternalTools.MyProject.Tests (MyProjectTests project)
      for the life of me and can not understand why in the MyProjectTests, under a [TestMethod()] (which is what the extension creates), I can't reference InternalTools.MyProject.MyClass (VS see's the InternalTools.MyProject. as validate, and the MyClass is public (in the main project), but IntelliStupids doesn't know what to do with it and it does show in the Error List?)
      anyone experience this before? (this is actually taking more time than the writing of the code) and again, all of my original unit tests WERE running when everything was in MyProject.
      please give me a hand here folks. all of the forums I've posted this question on recommended that I walk away from MSTest (and stick with NUnit which I know and like) due to memory leaks, stuff like what I've subscribed, etc.
      disappointment, since we are a Microsoft Partner and should be able to transfer this knowledge 
    • some more details:
      1. this is a console application (it's main purpose is to function like a CSVLint)
      here's an outline (of the MyProject and MyProjectTests):
      using System;
      using System.Collections;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Globalization;
      using System.Linq;
      using Microsoft.VisualBasic;
      using Microsoft.VisualBasic.FileIO;
      using Microsoft.VisualStudio.TestTools.UnitTesting;
      using System.IO;
      using System.Reflection;
      using System.Text;
      namespace InternalTools.CSVValidate
      class CSVValidate...
      public static class ArrayUtils...
      public class Utils...
      public class CmdArgExtractor...
      namespace InternalTools.CSVValidate.CsvParser
      public class CsvParser...
      public class CsvSerializer<T> where T : class, new()
      public class CsvIgnoreAttribute : Attribute { }
      public class InvalidCsvFormatException : Exception
      using System;
      using System.Collections.Generic;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
      using System.Collections;
      using System.ComponentModel;
      using System.Globalization;
      using System.IO;
      using System.Reflection;
      using Microsoft.VisualStudio.TestTools.UnitTesting;
      using Microsoft.VisualBasic;
      using Microsoft.VisualBasic.FileIO;
      using InternalTools.CSVValidate;
      namespace InternalTools.CSVValidate.Tests
          public class CsvParserTests
              public void ParseTest()
              private string[][] Parse(string input)
                  InternalTools.CSVValidate.CsvParser.CsvParser parser = new InternalTools.CSVValidate.CsvParser.CsvParser();  <-- CAN NOT figure out the class/namespace even though IntelliStupids is OK
                  using (StringReader reader = new StringReader(input))
                      return parser.Parse(reader);
    • Respectfully, I'm going to give this another hour or two to try to figure out.
      After that, and respectfully, you folks I'm sure have put in a lot of effort and time, time, but MS needs to get involved here at the top management and product levels. I hold product management accountable for "another" mess. (Already got burned several years ago when they pulled the Windows Service Project templates out of VS and had to resort to MS Engineers Googling to figure out how to make things run as a .NET Service. Again, simple 101 Product Mismanagement...
      Finally, I'm running VS Studio 2013 Ultimate if this is of any usefulness.
      Rob K
    • OK, figured out the root problem and this is a BUG FOR THE RANGERS.
      The Main Project --> MyProject is running on framework v4.5.1
      When you run this extension for the first time, it HAS NO CLUE as to what the framework of MyProject is (and/or it simply ignores it). A double-check of MyProjectTests revealed that it created the project (both under the same solution as framework v4.5 and not v4.5.1).
      A change of MyProjectTests from v4.5 to v4.5.1 fixes everything.
      Rob K
      PS If you rangers need any more details I'm at tutor@ebiz-developer.com
    • noticed RichLawley's post on the framework mismatch from Sunday.
      wish I'd noticed it sooner, it would have saved me a half a day :)
    • here's another one.
      when you create a MyProjectTests project, it seems to "crash" compile-ability with extension methods.
      so stuff like (in MyProject):
      	public static class ArrayUtils
      		public static string[] ToStringArray<T>(this IEnumerable<T> items)
      			return items.Select(i => i.ToString()).ToArray();
      		public static T[] RemoveAt<T>(this T[] source, int index)
      			T[] dest = new T[source.Length - 1];
      			if (index > 0)
      				Array.Copy(source, 0, dest, 0, index);
      			if (index < source.Length - 1)
      				Array.Copy(source, index + 1, dest, index, source.Length - index - 1);
      			return dest;
      starts throwing errors like:
      The call is ambiguous between the following methods or properties: 'InternalTools.MyProject.ArrayUtils.RemoveAt<string>(string[], int)' and 'InternalTools.MyProject.ArrayUtils.RemoveAt<string>(string[], int)'
      Rob K
      PS regretfully, I really think Product Management for VS needs to step up to the plate hereand think this one out better.
    • Bug #2
      Something in the Unit Test Generator extension mangles "extension methods" in the MyProject scope. This happens because the process of creating MyProjectTests mangles the references in MyProject by "self referencing". 
      (Yup, this is the Generator, because prior to it's introduction, MyProject worked for weeks w/o any sort of "funny business".)
      Even more fascinating is that VS 2013 Ultimate would even let this happen? (Can't think of a single scenario why a project would self reference or this would be legit in VS? <- maybe a bug for the VS team too.)
      Rob K  
1 - 10 of 39 Items