I have plenty of experience with NUnit and MBUnit, but I'm new to .NET Compact Framework development and I'd like to get off on the right foot.
Is there a prevailing unit testing framework for the .NET Compact Framework, and if so, what is it?
I have plenty of experience with NUnit and MBUnit, but I'm new to .NET Compact Framework development and I'd like to get off on the right foot.
Is there a prevailing unit testing framework for the .NET Compact Framework, and if so, what is it?
What's wrong with just using NUnit?
The unit tests don't need to run on the target device so I see no reason why you can't go with a normal unit testing framework.
Edit: Apparently this won't work, so ignore this solution. Please do not upmod.
@Simon: Modules compiled for CF.NET don't run on the desktop h/w, and therefore cannot be tested with NUnit.
Check out NUnitLite: http://www.codeplex.com/Wiki/View.aspx?ProjectName=NUnitLite
We use MSTest under TFS (2008). The great advantage is that it runs the tests on an actual device (we run both against emulators and physical devices) and the testing is driven from the server, not the device. This means you don't have to select tests to run, etc. from a device UI (a la CFNUnitBridge), which is painfully awkward and not conducive to continuous integration.
MSTest is not a cure-all, however. It has some serious drawbacks (like debugging tests is really painful and test startup is slow), but it's better than anything else we've tried. The hope is that as MS moves forward, usability will improve and we can keep moving forward with the test framework we have.
Using anything else we find to be too risky, as many frameworks and libraries for devices tend to wither and die without some major sponsor. NUnitLite for example only has had 477 downloads and very little code churn or activity in a two-year life as of this post - that doesn't inspire any confidence that it will grow in features.
For more on NUnitLite vs compiling to a desktop version, check out this question and responses... http://stackoverflow.com/questions/14497/has-anyone-used-nunitlite-with-any-success
You have probably figured this out already, but with Visual Studio 2008 Professional, the "best" way is to use MSTest (I'm an NUnit guy through and through, but this is it).
Right-click on a method or class and select "Create Unit Test". That will guide you through creating the test project with all of the dependencies you need to get started.
Key point, this will run the tests on the device -- which is what you want to happen, then report the results back to you in the MSTest runner.
There are still testing issues though. I can't find any mocking framework that works with .net cf. But it is a start.
For an embedded project running on Portable.NET, we ended up writing our own minimal version of NUnit, since we couldn't get the NUnit code to compile and run on that runtime. It wasn't really all that hard to do, actually.