I have a project made recently by a team member. I added some classes and wanted to unit test them. I added the project to our unit test solution, but I can't right-click on any function and select "Create Unit Test". I found a solution to manually type EditorContextMenus.CodeWindow.CreateUnitTests
in the command window, but then I get an error "Test generation is only supported on non test projects."
I searched for "test" through the whole project and only came up with PopulateStructure
so there's no functions with test attributes. I deleted a stray reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework
which the team member said had been automatically inserted by Visual Studio. The reference did not come back when I compiled, but I still couldn't auto generate tests.
I searched for [
and the only attribute outside AssemblyInfo.cs
is one of our own:
[AttributeUsage(AttributeTargets.All)]
public class OurAttribute_C : System.Attribute
{
...
I did a diff between this project file and another project file I'm testing, and saw nothing obvious. Same with the AssemblyInfo files.
I know I can manually create the tests without the tool, but why does VS2010 think that this project is a unit test project?
In searching for this I found a lot of complaints about the feature being entirely missing from VS2012 beta, I have the feature in other projects just not this one. A couple places had related complaints, but no answers.
Similar (slightly different) question with no answer: Unit test generation error in Visual studio website project?