Friday, May 6, 2011

TFS UnitTesting not deploying local copy assembly to test dir when on build server

I have an assembly that needs to be in the test output dir for my tests to run. I have the assembly referenced as a local copy in the project but on the build server this gets ignored. The two ways I have found to fix this are

  1. Add a special attribute to test method that will make sure the file is there for each test.

    [DeploymentItem("my assembly")]

    This is not very practical as this assembly is required for almost every test in the assembly.

  2. Add test run config file with special deployment section. I am using a TestContainer in my build scripts to run the tests I think that this may be the reason my included test run config does not get picked up and the assembly not copied. I would prefer to not have a vsmdi test list file as I am trying to run all tests and I feel this would be a violation of DRY.

Any suggestions on how I can get my tests running?

From stackoverflow
  • As my assembly was being dynamicly loaded the unit test framework was not copying it. I added a explict refrence to it by calling typeof on one of the types in the assembly and all is fine.

    Thanks Jerome Laban for your help with this one.

0 comments:

Post a Comment