8

我想用 NUnit 对我的 Windows Phone 7 库进行单元测试。

是否有与 Windows Phone 7 兼容的 NUnit 版本?

4

6 回答 6

3

您还可以查看http://unitdriven.codeplex.com - 它是 Silverlight 和 WP7 单元测试框架/运行程序,还有一个用于 nunit/mstest 的加载项 DLL,因此您可以编写测试并拥有相同的测试代码在 .NET、Silverlight 和 WP7 中运行。

只要您在测试非异步行为,UnitDriven 就与 nunit 非常兼容(我们构建它是为了运行数百个预先存在的 nunit 测试)。它确实有自己的异步测试模型 - 再次经过专门设计,因此相同的测试代码可以在 .NET、SL 和 WP7 中运行。

于 2010-09-03T03:01:27.503 回答
2

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.

于 2010-12-29T13:21:31.037 回答
1

我最近发现了以下工具,它们对 CI 集成很有帮助。

http://justinangel.net/WindowsPhone7EmulatorAutomation

以及更多信息(实际上是一个包含 5 个部分的系列文章):http: //blogs.msdn.com/b/vsdteam/archive/2007/11/20/corecon-api-part-1.aspx

于 2012-01-31T17:27:32.040 回答
1

由于 Windows Phone 7 基本上只是 Silverlight 3,我怀疑它会没事的。

有很多关于将 NUnit 与 Silverlight 结合使用的帖子,因此请尝试一下,您可能会获得很多成功。

这是一个使用 TestDriven.Net 和 NUnit 与 Silverlight:http ://weblogs.asp.net/nunitaddin/archive/2008/05/01/silverlight-nunit-projects.aspx

于 2010-08-31T15:32:59.800 回答
0

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

于 2011-12-23T08:52:04.477 回答
0

我最近发现了一个很棒的截屏视频,它展示了如何连接 NUnit,以便您可以在 Windows Phone 7 平台上进行 tdd。

它没有使用任何 silverlight 模板/等,只是一个普通的 WP7 类库和 NUnit

于 2011-07-26T14:49:34.647 回答