How do I run NUnit tests developed within VS2010 on a Mac? This seems like a very simple and naive question but I have been struggling to find all the steps. I have done my due diligence by scouring the web to find the exact steps. I have Mono on my Mac, but not monodevelop. How can i install NUnit on a Mac without mono develop? Do I need to add all the NUnit related dlls manually to Mono GAC or something?
Asked
Active
Viewed 5,523 times
1 Answers
4
No need to have monodevelop. After getting nunit you can just call it via (for instance)
mono nunit-console.exe your.dll
You can also do this using only binaries downloaded from nunit site, just be in the nunit's directory.
If there is no package for OS X, you can install it by making script invoking nunit (this is how standard nunit install on Linux works) and putting it in your search path. Adding assemblies to GAC is not necessary as long as they are with exe's.
For example this is nunit-console script on Ubuntu (which can be usually found in /usr/bin
):
#!/bin/sh
exec /usr/bin/mono --debug $MONO_OPTIONS /usr/lib/mono/2.0/nunit-console.exe "$@"
Of course you should replace /usr/lib/mono/2.0/
with directory which contains nunit.

konrad.kruczynski
- 46,413
- 6
- 36
- 47
-
i have the script on OSX as well called nunit-console.exe which has the following->#!/bin/sh exec /Library/Frameworks/Mono.framework/Versions/2.10.5/bin/mono --debug $MONO_OPTIONS /Library/Frameworks/Mono.framework/Versions/2.10.5/lib/mono/2.0/nunit-console.exe "$@" BUT i cannot run the mono nunit-console "tests.dll" command, it says cant find assembly so i tried running just nunit-console "tests.dll" command. It throws me the following exception While saving registry data at"/Library/Frameworks/Mono.framework/Versions/2.10.5/etc/mono/registry/last-btime" access is denied – RashMans Sep 28 '11 at 18:53
-
Also, does the latest version of NUnit support .net 4.0? the current NUnit which i got with the latest version of Mono seems to support only .Net 2.0. Am i missing something? – RashMans Sep 29 '11 at 18:16
-
About .NET4.0: yes. You have to use at least NUnit, version 2.5. Also to target 4.0 you need to make small change in NUnit's config file. This is described here: http://stackoverflow.com/questions/930438/nunit-isnt-running-visual-studio-2010-code/932410#932410 – konrad.kruczynski Sep 29 '11 at 20:30
-
About other issues: does your application use registry? In case of assembly exception - which assembly specifically? – konrad.kruczynski Sep 29 '11 at 20:32