I am having several problems running tests with new functionalities of Nunit Framework version 3.5
On SharpDevelop 5, I checked the version of Nunit Console installed on SharpDevelop 5 (SharpDevelop\5.1\bin\Tools\NUnit) and it is old (2.6.3.0). I think that by performing the upgrade to Nunit Console Version 3 I will not have any more problems.
Looking on Nuget I found NUnit Console Runner Version 3, but it is not being installed on SharpDevelop 5.
So, how can I upgrade the Nunit Console Runner?
This was interesting - I learned something.
SharpDevelop comes with an nunit-console.exe 2.6.3 file which is not the same as our (nunit's) nunit-console.exe 2.6.3. All the other nunit assemblies appear to be the distributed NUnit binaries but this one is where they have added some new options and made some fixes. Consequently, I don't believe you can just drop in any release of NUnit you like and have it work.
In any case, even without the special executable build, you could not just drop in nunit3-console and the associated NUnit 3 assemblies. NUnit 3 is actually an entirely new program. It works differently from earlier releases internally and has a different set of options on the command-line.
Consequently, you are forced to stick with NUnit 2.6.x so long as you want to use the SharpDevelop runner. I'll look into possibly helping them with an upgrade (probably a new NUnit3 tool) if they are interested.
Related
I'm trying to run some NUnit tests written in Visual Studio on the command line using NUnit console. The tests are built using .NET 4.5.
To run them, I'm typing:
nunit3-console mytests.dll
And I keep getting a pop-up which tells me "an application on your PC needs the following Windows feature: .NET Framework 3.5 (includes .NET 2.0 and 3.0).
I've tried forcing NUnit to use 4.5 by saying
nunit3-console /framework:net-4.5 mytests.dll
But I get the same thing.
I tried installing .NET 3.5, but it can't be installed (I guess because I don't need it as I already have 4.5).
The tests run fine when run from Visual Studio using ReSharper or in the NUnit GUI...
I've created a really simple solution (tried with .NET 4 and .NET 4.5) which has a NuGet reference to NUnit 2.6.4 and one class (below):
[TestFixture]
public class Class1
{
[Test]
public void MyTest()
{
Assert.Pass();
}
}
I still get the same error.
How can I fix this?
That executable itself (nunit3-console) must have been produced by C# compiler to target .NET Framework 2.x/3.x (for the so called compatibility). Thus, when it runs on a pure .NET Framework 4.x Windows, you see the other compatibility feature by Microsoft, where it always prompts and asks to install .NET Framework 3.x (you must do that via Programs | Add/Remove Windows feature). Both of them are ridiculous as people should rarely use .NET Framework 2.x/3.x (though Microsoft will keep supporting .NET Framework 3.x as part of Windows).
To get rid of that prompt, you can enable .NET Framework 3.5 (which also gives you the bits to compile against .NET Framework 2.x/3.x). Or you modify its nunit3-console.exe.config file to use <supportedRuntime> to force .NET 4.x is used to load this executable.
I guess the NuGet version contains a proper .exe.config, while the MSI version not. You can analyze further for sure.
In my solution there are several projects, some are using NUnit 2 and some are using NUnit 3.
They have the relevant test adapters and versions installed via NuGet.
When my TFS build runs, I get the error:
Error: Exception NUnit.Core.UnsupportedFrameworkException, Exception
thrown executing tests in
E:\BuildAgents\Agent1_work\9\s\Kittens_Local\Kitten\kitten\kitten\Kitten.Fluffy.Tests\bin\Debug\Kitten.Fluffy.Tests.dll
This project is using version 3 while the other tests are using version 2.
Is it possible to get both working simultaneously in TFS?
This seems to be a issue in Nunit2 adapter(Nunit TestAdapter Nuget Package). So you could not get both working simultaneously in TFS. More details please refer Charlie's answer in this question: nunit tests throwing exception only when run as part of tfs msbuild process
If you have both adapters installed, each one will run the tests for
which they are designed. Each of them will display a message in for
any assembly that they do not support. The message isn't meant to be
an error and we try to word it in such a way that it won't be taken as
such. However, we felt we have to give it just in case you expected
the assembly to be handled by that particular adapter. Passing it by
silently seems wrong.
When running under the VS IDE, the message does not cause a failure in
the test run. It appears that running under TFS does cause a failure.
If memory serves, we fixed this problem for the NUnit 3 adapter but
not (yet) for the NUnit 2 adapter.
I changed the Gallio.NUnitAdapterLatest.plugin with a binding redirect to this : oldVersion="2.6.0.0-3.0.5813.39032".
I also overwrote tje previous dlls in the latest subfolder.
I changed all occurences in the config file to no avail.
I also debugged the source code but did not manage to make it take my dlls.
What itches me is "compatiblity" between 2.6.x and 3.0 of nunit since as I read it somewhere, this trick can only be done if compatibility between the two dlls are maintained, which I am not sure.
I compiled Gallio in X86, for a .Net 4 test project.
Any ideas ?
I very highly doubt that you will get NUnit 3.0 running under Gallio's adapter. NUnit 3 is a nearly complete rewrite and it's engine is not at all compatible with the 2.6 core.
In order to get it working, you will need to create a new NUnit3 adapter for Gallio. Since Gallio is a dead project, I wouldn't expend the effort. Gallio's test runner is nice, but why are you still using it to run NUnit tests?
I just upgraded to version 3.0.1 from nunit 2.6.4. It used to have a NUnit Gui Runner, located here:
After installing 3.0.1 (which I downloaded windows version from here)
I now no longer see the nunit.exe in the installation folder, for example the directory structure is different and appears to be missing many files that were part of the previous installation:
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.
The "final" release is here, you can find it at: https://github.com/TestCentric/testcentric-gui/releases
For anyone coming to this page, looking where to find the NUnit Gui, please note that on http://nunit.org/?p=download you can get version 2.6.4, which does contain the Gui.
UPDATE
As pointed out in the comments, a lot has changed since, and you should no longer use the 2.x version tools, rather use the new TestCentric UI found at https://github.com/TestCentric/testcentric-gui/releases
I'm trying to get Gallio running some existing NUnit tests but they're not showing in Gallio. The assembly loads into Gallio fine and I can run them fine via Resharper within the VS IDE.
I created a really simple NUnit test in VS and this also doesn't show so I know it's not something weird in my existing tests.
Any ideas?
Current version of Gallio (3.1 build 397) only supports NUnit up to 2.5.2.
But if you drop in the new 2.5.5 assemblies into C:\Program Files (x86)\Gallio\bin\NUnit\v2.5 and update Gallio.NUnitAdapter25.plugin with the new version numbers you should be good to go.
As Carl said, Gallio v3.1 only supports NUnit up to v2.5.2. I suggest you use Gallio v3.2 instead. It's still in beta but is very stable already. You may want to try the latest daily build.
UPDATE1: Gallio v3.2 now RC
UPDATE2: There is breaking change in the test model of NUnit v2.5.4. The Gallio NUnit adapter has been updated accordingly. You might want to use Gallio 3.2 build 520 or later.
Just a shot in the dark--are your text fixtures public?