How to run NUnit test on Ubuntu from the command line?
I've created file OnlyTest.cs
using System;
using System.Text;
using System.Collections.Generic;
using NUnit.Framework;
[TestFixture]
public class OnlyTest
{
[Test]
public void MyTest()
{
int a = 10;
Assert.AreEqual(10, a);
}
}
According to article Running NuGet command-line on Linux I've downloaded files NuGet.exe and Microsoft.Build.dll
I've run NuGet to install NUnit
$ mono NuGet.exe install NUnit
Installing 'NUnit 2.6.4'.
Successfully installed 'NUnit 2.6.4'.
$ ls -lR
.:
razem 1668
-rw-rw-r-- 1 mw mw 28861 cze 24 23:45 Microsoft.Build.zip
-rw-rw-r-- 1 mw mw 1664512 cze 24 23:42 NuGet.exe
drwxrwxr-x 3 mw mw 4096 cze 25 00:29 NUnit.2.6.4
-rw-rw-r-- 1 mw mw 208 cze 25 00:27 OnlyTest.cs
./NUnit.2.6.4:
razem 108
drwxrwxr-x 2 mw mw 4096 cze 25 00:29 lib
-rw-rw-r-- 1 mw mw 1131 cze 25 00:29 license.txt
-rw-rw-r-- 1 mw mw 99004 cze 25 00:29 NUnit.2.6.4.nupkg
./NUnit.2.6.4/lib:
razem 720
-rw-rw-r-- 1 mw mw 151552 cze 25 00:29 nunit.framework.dll
-rw-rw-r-- 1 mw mw 584600 cze 25 00:29 nunit.framework.xml
Since I'm not sure about compiling and running
Compiling hadn't produce any errors
mcs OnlyTest.cs -target:library -r:NUnit.2.6.4/lib/nunit.framework.dll -out:OnlyTest.dll
But when I try run nunit I get errors like
$ nunit-console OnlyTest.dll -noresult NUnit-Console version 2.6.0.0 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 3.16.0.30 CLR Version: 4.0.30319.17020 ( Mono 4.0 ( 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1.1) ) ) ProcessModel: Default DomainUsage: Single Execution Runtime: mono-4.0 Missing method .ctor in assembly /[MY_PATH]/OnlyTest.dll, type NUnit.Framework.TestFixtureAttribute Can't find custom attr constructor image: /[MY_PATH]/OnlyTest.dll mtoken: 0x0a000001 Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies.
The same goes for nunit-gui