Test Deployment Items

 

I have been playing with the new Nhibernate bits, and working through the tutorial here, now he uses MbUnit, and NUnit which are great frameworks for testing, but I wanted to use the test framework supplied with visual studio.

The problem comes when the test is looking for the Hibernate configuration file, which the ms test framework cannot find, because the test runs in its own folder, and not in the debug bin folder as the other frameworks do, so we need to have a way of copying the file to this directory which could quite easily change!

Reading the MSDN help I discovered that the LocalTestRun.testrunconfig file has a deployment option, which can specify a file or directory, sadly the file can only be an executable or dll.  So I simply chose the debug bin directory of the project that contained the hibernate configuration file and ensured that the hibernate.cfg.xml file was set to copy if newer, or copy always.  and it all worked.

The only problem with this is that I am not only copying the hibernate file, but also ALL the dlls etc in the project bin folder, this makes the startup time for the tests slightly longer, but it does give me a chance to get a sip of tea before continuing with the refactoring 🙂

Advertisements

About Duncan Butler

Trying to be a very agile software developer, working in C# with Specflow, Nunit and Machine Specifications, and in the evening having fun with Ruby and Rails
This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s