Closed twenzel closed 8 years ago
@twenzel ah, so you're running the benchmark and the code inside the .DLL depends on values found inside the .config
file via ConfigurationManager
? Ok - do you know if there's a standard way to do that for a dependent assembly? The NBench.Runner.exe
has its own App.config that loads but I don't know about being able to load multiple ones if you catch my drift.
At the moment I don't know how to do this. May be if the assembly is loaded in a dedicated AppDomain. I'll check the NUnit source because they're supporting this feature.
@Aaronontheweb You can provide the file name via the ConfigurationFile
property on the AppDomainSetup
class.
@twenzel so would that require loading the test assembly into its own AppDomain
?
Yes. I guess this is the best option. When loading the test assembly into its own AppDomain
you have control over the config file, the base path, private bin path, shadow copying. You can also change the target framework version.
You can even unload the assembly/appDomain so you can execute multiple benchmarks with different assemblies (even in parallel).
Where can i find the Nbench.runner.exe config? I'm trying to get to an EF connection string in the test. Thanks
@twenzel looks like we're going to need to add some AppDomain loading support for this - I don't anticipate this being a huge amount of work.
@laitang2000 should be inside the same folder as the NBench.Runner.exe
- if it's not in there you can add one.
@twenzel I'm going to be a bit delayed on adding support for that myself - would you like to take a stab at adding it and submitting a pull request?
Yes, you can assign this issue to me.
Closed by #75
To run my unit tests/benchmark my code is dependent on configurations made in the config file (app.config). Please support loading those files either implicit by the assembly name + ".config" or explicit via CLI argument.