I recently ran into an interesting gotcha with VSTS 2010. I added a Library project to my solution that I intended to populate with integration tests. When I created the project, I chose the Class Library template. I then added a class to the project that would represent my test fixture. Expecting VSTS to leverage the [TestClass] attribute that I applied to the class, I went about adding test cases and attributed them with [TestMethod].
When I went to my Test View, the methods that I’d added didn’t show up :( The problem was that I expected VSTS to behave similarly to NUnit, which reflects over the classes looking for the [TestFixture] attribute to figure out which classes contain tests. VSTS does not do it that way; rather, you have to modify the .csproj file to include a new element
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Once I added that element to the project, the Test View happily found my new tests.
Hope this helps you if you run into a similar problem.
No comments:
Post a Comment