How can I make VS understand that a project is a test project?<p><font face="Verdana, Geneva, Arial, Sans-serif" size=2>I have a project that was not created as a test project. But it was running tests in a very unit test like way, so I added <em>using </em><font size=2><em>Microsoft.VisualStudio.TestTools.UnitTesting;</em> to each source file along with the apropos [Test*] attributes so that I could run the unit tests from VS. However, VS doesn't recognize the tests. If I choose Test.Windows.TestView, my tests are not showing up there. Is there a way to get VS to recognize these tests?</font></font></p> <p><font face=Verdana size=2>Thanks...Rick</font></p>© 2009 Microsoft Corporation. All rights reserved.Wed, 08 Oct 2008 22:45:33 Zc7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9ahttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9ahttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9aRickKrhttp://social.msdn.microsoft.com/Profile/en-US/?user=RickKrHow can I make VS understand that a project is a test project?<p><font face="Verdana, Geneva, Arial, Sans-serif" size=2>I have a project that was not created as a test project. But it was running tests in a very unit test like way, so I added <em>using </em><font size=2><em>Microsoft.VisualStudio.TestTools.UnitTesting;</em> to each source file along with the apropos [Test*] attributes so that I could run the unit tests from VS. However, VS doesn't recognize the tests. If I choose Test.Windows.TestView, my tests are not showing up there. Is there a way to get VS to recognize these tests?</font></font></p> <p><font face=Verdana size=2>Thanks...Rick</font></p>Thu, 08 Jun 2006 22:09:35 Z2006-06-09T00:37:33Zhttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#dced7d2d-178f-4982-bdba-b730c8d422ffhttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#dced7d2d-178f-4982-bdba-b730c8d422ffChristine Zhao - MSFThttp://social.msdn.microsoft.com/Profile/en-US/?user=Christine%20Zhao%20-%20MSFTHow can I make VS understand that a project is a test project?<p class=MsoNormal><font face=Arial size=2><span style="font-size:10pt;font-family:Arial"><font color="#000000">Hi Rick,</font></span></font></p> <p class=MsoNormal><font face=Arial size=2><span style="font-size:10pt;font-family:Arial"><font color="#000000">There are two ways to solve the problem.  </p> <p class=MsoNormal>1. Locate your project file (e.g. .csproj or .vbproj) on the file system, open it using a text editor. You will notice it is in XML format. Insert the following line (child node) into the existing &lt;PropertyGroup&gt; &lt;/PropertyGroup&gt; (parent node) if your test code is in C#</p> <p class=MsoNormal>&lt;ProjectTypeGuids&gt;{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}&lt;/ProjectTypeGuids&gt;</p> <p class=MsoNormal>If your test code is VB, you should use the following</p> <p class=MsoNormal>&lt;ProjectTypeGuids&gt;{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}&lt;/ProjectTypeGuids&gt;</p> <p class=MsoNormal>After you save the project file and reload it in VS, Test View window should show the test methods in your project if they are created correctly.</p> <p class=MsoNormal>Please note C++ project use ProjectTypes attribute to identify the test project. To find out the attribute, just create a new C++ test project and open the project file using a text editor. Copy the attribute and its value and add it to your regular project file, then Test View window will recognize it as a test project.</p> <p class=MsoNormal>2. If you prefer doing it from the VS UI, you can add a new Test Project to you solution, add reference Microsoft.VisualStudio.TestTools.UnitTesting.dll if it is not in the references list. Move the test class from your old project into the test project</p> <p class=MsoNormal>Please let me know how it goes. </p> <p class=MsoNormal>Thanks,</p> <p class=MsoNormal>Christine Zhao</font></span></font></p>Fri, 09 Jun 2006 00:32:43 Z2006-06-09T00:37:33Zhttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#edb2068b-b37c-41a0-bb96-2797a83abbe8http://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#edb2068b-b37c-41a0-bb96-2797a83abbe8RickKrhttp://social.msdn.microsoft.com/Profile/en-US/?user=RickKrHow can I make VS understand that a project is a test project?<font face="Verdana, Geneva, Arial, Sans-serif" size=2>The first solution took care of it. Thanks so much!</font>Fri, 09 Jun 2006 16:33:23 Z2006-06-09T16:33:23Zhttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#f8389992-9cca-4713-bd20-9aa5f62ea26chttp://social.msdn.microsoft.com/Forums/en-US/vststest/thread/c7f9c0c0-3fd8-4bb8-952c-e7a064f0ed9a#f8389992-9cca-4713-bd20-9aa5f62ea26cSwapnil2006http://social.msdn.microsoft.com/Profile/en-US/?user=Swapnil2006How can I make VS understand that a project is a test project?<p>Hi</p> <p>I am not able to open sample Nunit cs project file in Visual Studio 2005 . I tried to create a new cs project file and add reference to <font face=Verdana size=2>Microsoft.VisualStudio.TestTools.UnitTesting but cold not find it ..</font></p> <p><font face=Verdana size=2>Is this reference available only for VSTS or am I  missing something.Please Help.</font></p> <p><font face=Verdana size=2></font> </p> <p><font face=Verdana size=2>Thanks</font></p> <p><font face=Verdana size=2>Swapnil</font></p> <p><font face=Verdana size=2></font> </p>Wed, 08 Nov 2006 05:38:56 Z2006-11-08T05:38:56Z