共用方式為


Unit testing with Silverlight

image One of the things I was most excited about when we shipped the Silverlight 2 Beta 1 controls was the included unit testing harness, written by Jeff Wilcox.  I think it's a good thing when we can share some of our internal tooling.  It's good for customers, because they can leverage the work that we've been doing, and it's good for people here because it gives them a chance to "ship" something and get some visibility in the industry.  And this is definitely the case with the Silverlight Unit Test Framework, which Jeff has just updated for RC0.

This is the exact package that we're using internally to run our automated unit tests and we've been adding features to it as our team grows.  Oftentimes, development teams here at Microsoft use a different testing harness from what the testing teams use (please don't ask...) and I'm keen to avoid that setup, and the Silverlight Unit Test Framework provides the functionality for both.  And that we're allowing customers to leverage it opens up some other possibilities that I'll get into later.  Note that the Silverlight Unit Test Framework is an unsupported toolset, not an official Microsoft product.

Some of you may be asking why we wrote our own unit testing harness instead of using something like nUnit or MbUnit.  The main reason is because the existing offerings were all written against the full .NET Framework.  Even though Silverlight is .NET code, it really is a different platform.  And it has some special needs due to the constraints on the type of reflection you can use (public only) and how you're able to instantiate and discover tests.  So we decided we needed a harness that was written fully in Silverlight and hosted the tests directly in the harness itself.  This has worked out well.

So if you're starting to get rolling with Silverlight, and you want to do some unit testing, definitely give the Silverlight Unit Test Framework a look.

More details here.

Comments

  • Anonymous
    September 30, 2008
    PingBack from http://www.easycoded.com/unit-testing-with-silverlight/

  • Anonymous
    October 04, 2008
    This blog will rarely be the place for breaking news, but there are two related pieces of information

  • Anonymous
    October 04, 2008
    This blog will rarely be the place for breaking news, but there are two related pieces of information

  • Anonymous
    October 04, 2008
    This blog will rarely be the place for breaking news, but there are two related pieces of information

  • Anonymous
    October 05, 2008
    A colleage of mine created a ReSharper plugin for running Silverlight Unit Tests directly from Visual Studio. Check it out. It's saving us a lot of time, while running tests. http://www.ingebrigtsen.info/post/2008/09/21/Silverlight-UnitTest-runner-for-Jetbrains-ReSharper.aspx

  • Anonymous
    October 14, 2008
    As you know, today we released Silverlight 2 .  Scott mentioned the Silverlight Toolkit in his post

  • Anonymous
    July 21, 2010
    Great piece of Info! Thanks for sharing it with us, it will be a challenge task to test how different this new platform is. Hope so i get my hands on this real soon.