In the past I used NUnit for all my unit testing needs it was free and worked fine. Creating a test class all I needed to do was to create a class library (dll) and add the needed attributes and start writing my tests.
Now I use Microsoft’s testing framework that shipped with Team System as a part of my unit testing solution and every now I make the mistake of creating a class library instead of a Test Project. This time adding MS-Test attribute (TestClass) doesn’t help – Visual Studio doesn’t recognize the test and I can’t run it.
In case you make the mistake of creating a class library instead of a test project you can do one of the two things:
- Delete the project and re-create it
- Read below…
To convert a class library to Test project follow these four simple steps:
- Unload the project (.prj) file and then open it for update.
- add the following line to the project
C# – {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
VB – {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} - Re-load the project back
- Run you (now working) tests
Simple isn’t it?
VS 2008 – doesn't work.
Strange I've used this method in VS2008 successfully
Thanks a lot, works for VS2010. However I took the exact guids from neighborhood project of the same solution.