State of unit testing for Windows Phone

前端 未结 6 1165
抹茶落季
抹茶落季 2021-02-04 03:16

I\'ve been pushing my Google Fu to the limits trying to find the most recommended / stable setup for doing TDD + CI for Windows Phone applications. Can anyone who has successful

6条回答
  •  北海茫月
    2021-02-04 04:00

    Well, there are at least 3 different ways to do TDD for Windows Phone apps.

    1. Silverlight Unit Test Framework - written by Jeff Wilcox. Here you can find its latest update. It seems it is most popular way, there is a lot of information about this approach:

      • First of all Jeff's screencast Unit Testing Silverlight and Windows Phone Applications
      • Unit Testing with Silverlight for Phone7
      • Windows Phone 7 – MVVM Light and Unit Testing Example
      • Good TDD kata - Building a Windows Phone 7 app with MVVM pattern, using TDD and mock objects
      • Unit Testing the Windows Phone 7 applications

      Also please check Visual Studio test project template so that you don't need to create test project manually. However, this solution requires running your tests on phone emulator what sometimes can be very annoying.

    2. Portable Library Tools - a new Visual Studio add-in from Microsoft which enables you to create C# and Visual Basic libraries that run on a variety of .NET-based platforms without recompilation, including Windows Phone.

      Check this post to see how to do TDD for Windows Phone with Portable Library Tools. Here you can find a Visual Studio extension.

      The drawback of this approach is that this library has a limited assemblies support, thus most probably you cannot use everything that you have used to do. For example you cannot use commands (since ICommand lives in PresentationCore.dll), you cannot use MVVMLight as well, etc. From the other hand, it gives you more flexibility in your test project (you can use different mock frameworks,IoC containers run tests from VS, run tests with Resharper and so forth).

    3. Silverlight NUnit Project VS template. Check this blog post to see how to use this template in your project. Also check the Toran Billups screencast that appeared in this thread. Be aware that you might have problems using Silverlight NUnit Project with some other frameworks or programs like Moq or Resharper.

提交回复
热议问题