NUnit with Windows Phone 7

I'd like to unit test my Windows Phone 7 libraries with NUnit.

Is there a version of NUnit compatible with Windows Phone 7?

Answers


You might also look at http://unitdriven.codeplex.com - it is a Silverlight and WP7 unit test framework/runner, that also has an add-in DLL for nunit/mstest so you can write tests and have the same test code run in .NET, Silverlight and WP7.

As long as you are testing non-async behaviors, UnitDriven is pretty compatible with nunit (we built it to run a few hundred pre-existing nunit tests). It does have its own model for async tests - again specifically designed so the same test code runs in .NET, SL and WP7.


What you are searching for is nunit-silverlight. You need to reference "NUnit.Silverlight.Framework.dll" and "NUnit.Silverlight.Compatibility.dll" (SilverLight 3 versions), and make all references "local copy", even the .NET framework.

If you use Visual Studio Express Edition, there is still some obstacles that I detailed a bit more on my blog. In short: Express Edition doesn't include tests or add-ins, and it should work fine with external test runners but for my part I've got an exception in NUnit's GUI, so one may need something else to run his tests (NUnit-Console, Gallio, Autotest.NET, ...). I use TddBarForPhone (available on codeplex), a tool I made which runs NUnit-Console after each build and color the results in red or green.


As Windows Phone 7 is basically just Silverlight 3 I suspect that it will be fine.

There are multiple posts about using NUnit with Silverlight, so give them a try and you will probably have lots of success.

Here is one on using TestDriven.Net and NUnit with Silverlight: http://weblogs.asp.net/nunitaddin/archive/2008/05/01/silverlight-nunit-projects.aspx


I have recently discoverted the following tools which can be additionaly helpful for CI-Integration.

http://justinangel.net/WindowsPhone7EmulatorAutomation

and more on that (which is a series of articles having 5 parts actually): http://blogs.msdn.com/b/vsdteam/archive/2007/11/20/corecon-api-part-1.aspx


I found a great screencast recently that shows how to wire up NUnit so you can tdd on the Windows Phone 7 platform.

It's not using any silverlight templates/etc just a plain WP7 class library and NUnit


I've had a port of this ready for a while and finally uploaded it to NuGet.org

Install-Package NUnit.WP

NuGet package: http://www.nuget.org/packages/NUnit.WP

Source: http://bitbucket.org/jesperll/nunit-silverlight


Need Your Help

Alternatives for 3 lines of java-like code?

python python-2.7

Assume you have a function, that sometimes returns a value, and sometimes doesn't, because there really is nothing you could return in this case, not even a default value or something. Now you want...

How to include the replaced string in the replacement in Eclipse?

regex eclipse string

I am using the following regex to find strings of type