While I feel that using config files for NUnit tests is a no-no (it's an integration test, in that case, I assume), there are various approaches you can try:
- Put all your different connection strings under web.config in the connectionstrings section, with different keys. Access them via the System.Configuration classes.
- For each project or DLL you can add an app.config file where you can store assembly specific information. This will be renamed as ProjectName.dll.config once compiled. Again you can access the contents of this file using System.Configuration
- Create a new assembly that simply loads all these connection strings from a single file. And then access this assembly
If you are loading different web applications into the same directory (as you're saying you're accessing web.config files -- which means web applications) then you're making your life difficult. Each application has to have their own folder and virtual directory, and a web.config specific to only that application.
Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77'
Check which nunit-console/nunit assemblies that are installed... I assuming it is picking up old assemblies in the GAC.
Lets start from the beginning:
Get the latest and greatest NUnit AND it's Runner tools
curl https://api.nuget.org/downloads/nuget.exe -o nuget.exe
mono nuget.exe install NUnit
mono nuget.exe install NUnit.Runners
Make sure the mono is finding those assemblies first (vs the GAC)
export MONO_PATH=$(PWD)/NUnit.Runners.2.6.4/tools:$(PWD)/NUnit.2.6.4/lib
Create your test example and compile it:
vi OnlyTest.cs #Using the example in your question
mcs OnlyTest.cs -target:library -r:NUnit.2.6.4/lib/nunit.framework.dll -out:OnlyTest.dll
Run it:
mono ./NUnit.Runners.2.6.4/tools/nunit-console.exe OnlyTest.dll -noresult
Output:
Using default runtime: v4.0.30319
NUnit-Console version 2.6.4.14350
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 14.3.0.0
CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 4.3.0 (master/b044a27 Thu Jun 18 15:17:08 PDT 2015) ) )
ProcessModel: Default DomainUsage: Single
Execution Runtime: mono-4.0
.
Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0280499 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Best Answer
The NUnit team decided to make the GUI a separate product and will be releasing it separately. It is being rewritten from the ground up for NUnit 3, but hasn't been released yet. Development is happening on the GitHub page at https://github.com/nunit/nunit-gui if you want to get involved or track the progress. Initial releases will be out soon.
Update - There have been several preview releases of the new NUnit GUI that can be found at https://github.com/nunit/nunit-gui/releases. The previews are not recommended for production use, but they work and can be used.