Run unit tests in different appdomain with NUnit

后端 未结 3 926
梦毁少年i
梦毁少年i 2020-12-03 11:37

I seem to be having an issue, the application we\'re using uses a Ninject kernel, and contains a particular configuration that\'s gathered with contents of the WCF call (use

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 12:28

    I don't think there is a way to solve it without re-writing parts of the NUnit code. It has been a while since I've been inside the NUnit code, but I am pretty sure the main app domain loading part has not changed.

    NUnit typically uses two app domains. The default one that is created when NUnit is run and a separate one to load the test assemblies and the assemblies they reference. It's main reason in doing this is to allow the unloading of the test assemblies. You can't unload a dll, but you can unload an appdomain.

    You might be able to run NUnit once per test and pass the test on the command line, but that's ugly and I'm not sure it will help.

    It might also be possible to leverage Action Attributes in NUnit 2.6, but you are going to do a lot of work in there to do it.

    You might also be able to create a new app domain in your setup method and call into it in each test. Awkward but possible.

    I'm sorry I don't have a more complete answer.

提交回复
热议问题