Sunday, April 26, 2009

MSTest and TeamCity trouble

When I run test from Visual Studio all tests pass but when I setup test environment from Teamcity half of my test fails.

Problem was because some of assemblies was missing in mstest environment. Actually, I have used Enterprise library and I had custom trace listener. Test project had that trace listener in references. But when Teamcity runs mstest my assembly was missing in build agent working folder.

All assemblies that are not used directly in test (for example class from my assembly was dynamically loaded by enterprise library application logging block) will not be copied to test folder. Therefor, those test methods should be decorated with attribute like:


[DeploymentItem("MyTraceListener.dll")]


Somehow, this was not necessary when you run tests from Visuals Studio IDE.

I hope that I save you some time.

No comments: