Wednesday, May 27, 2009

NHibernate and Micrsoft Team Test

I couldn’t find much information on using Microsoft’s Team Test Suite and NHibernate so here’s the condensed version so you don’t have to have the same issues I went through.

If you use the “Getting Started” guide here and substitute Microsoft’s test suite for NUnit add the following attributes just below the [TestClass] attribute on the class definition.  Remember to substitute your database’s name in for [Database Name].

[DeploymentItem("hibernate.cfg.xml")]
[DeploymentItem("[Database Name].sdf")]

This will tell the test suite these are dependencies and to deploy them to the TestResults folder where the tests are run.

Voila!  Everything “should” run as advertised but remember to place these on every single test fixture you create.  Its a bit of a pain and I hope Microsoft can fix this in either a service pack of Visual Studio or in the next version.

0 comments: