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?
xUnit test is the best Unit testing framework for . Net programming languages like C#, VB.Net, and F#. xUnit derives its structure and functionality from SUnit of Smalltalk.
NET Core. The three major C# Unit testing frameworks are MSTest, NUnit, and xUnit.Net.
xUnit. xUnit.Net is a popular unit test framework used for test automation. 'x' in xUnit stands for the programming language for which the test framework is built i.e. JUnit for Java, NUnit for C#, etc. It is a unit test framework that is built by the creators of the NUnit framework.
The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.
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.
@Simon: Modules compiled for CF.NET don't run on the desktop h/w, and therefore cannot be tested with NUnit.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With