4

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?

Graham Ambrose
  • 1,891
  • 2
  • 13
  • 17
  • 1
    Is your test assembly making explicit reference to types present in the "My Assembly" assembly ? If it does not for some reason, like dynamic loading of types, that could be the problem. – Jérôme Laban May 13 '09 at 02:17
  • I am using SQLite in memory database with NHibernate. The SQLite assembly is being dynamically loaded by NHibernate. I did include a reference in the test assembly but there is no reference to types. I will try adding an explicit type reference when I am setting up my tests see if that helps. – Graham Ambrose May 13 '09 at 17:44

1 Answers1

3

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.

Graham Ambrose
  • 1,891
  • 2
  • 13
  • 17