V3 Documentation
Search

Cross Application Domain Testing

Description

It is quite common for some integration tests to create their own application domains or spawn their own child processes during execution. There are various reasons for this, such as seeking more control over the execution environment (i.e. better isolation), or in order to test production code that behaves in this way. While NCrunch does support integration tests of this kind, their behaviour requires some special consideration.

Possible Problems

When tests take responsibility for launching their own processes and building application domains, they often make assumptions about referenced EXEs and DLLs being collocated with the test assembly. This can result in FileNotFound exceptions being thrown at runtime.

Solutions

For tests that fail to build application domains and child processes due to NCrunch's assembly collocation rules, a solution is often possible where the application domain can be built using the assembly locations from the hosting test application domain. A simpler but less effective solution can be to use the Copy referenced assemblies to workspace configuration setting.