Silverlight unit testing templates updated

Getting into the habit of unit testing your Silverlight applications is a little easier now. I posted updated templates for the Silverlight Unit Test Framework on the MSDN Code Gallery site. There are project and item templates for Visual C# as well as Visual Basic.

Download the templates

Direct download link to the templates (Zip, 46K)
Direct download link to the Silverlight Unit Test Framework binaries (Zip, 284k)

To install, just drop the templates and binaries in the right directories.

Project templates go here: %userprofile%\Documents\Visual Studio 2008\Templates\ProjectTemplates
Item templates: %userprofile%\Documents\Visual Studio 2008\Templates\ItemTemplates
And the unit test framework binaries: %programfiles%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client

New to Silverlight unit testing?

DockPanel tests 
WrapPanel tests running in the Silverlight Unit Test Framework

Upgrade your Beta 2 test projects

There’s a breaking changes guide for the test framework, for anyone who was using the last version for Beta 1 and/or Beta 2 development.

Thanks to Marius Rochon for sending me one of these and challenging me to get them all updated for the final release of Silverlight 2. Hope this helps!

  • Valentin

    Hi Jeff,
    the testing framework is really great. One thing that I’m really missing is the CodeCoverage. Do you have any plans on supporting that – It’s really important.


    Valentin

  • http://www.jeff.wilcox.name/ Jeff Wilcox

    @Valentin,
    We’re trying to find the best way to get an easy-to-use solution out there.

    The rather abstract and extensible “Test Service” built into the RC0/RTW release of the test framework includes support for reporting block-level code coverage of a single assembly.

    Using it requires a separate instrumentation process that is different from the one that ships in Visual Studio, and is not generalized yet for us to release it. I’d love to get this done, so stay tuned.

  • Pingback: 2008 October 24 - Links for today « My (almost) Daily Links

  • Sudhir

    Hi,

    I’m using the latest SL unittest binaries for unittesting my SL projects. It surely is a very handy tool. (wishing MS integrates it into VS sometime in the future). However i have a small glitch.

    With unit testing framework of .net and Visual Studio 2008, we can pull in any class, methods,properties which are *private* or *internal*. Visual studio generates the unit test code and automatically adds these magic code behind the accessor so that all private/public methods are accessible to test code.

    [Shadowing("UnitTest_TestApp.Program")]
    public class Program_Accessor : BaseShadow
    {
    protected static PrivateType m_privateType;

    [Shadowing(".ctor@0")]
    public Program_Accessor();
    public Program_Accessor(PrivateObject __p1);

    public static PrivateType ShadowedType { get; }
    [Shadowing("Str")]
    public string Str { get; set; }
    [Shadowing("str")]
    public string str { get; set; }

    [Shadowing("Add@1")]
    public string Add(string str);
    [Shadowing("Add@2")]
    public string Add(string str, float f);
    [Shadowing("Add@2")]
    public string Add(string str, int i);
    public static Program_Accessor AttachShadow(object __p1);
    [Shadowing("Main@1")]
    public static void Main(string[] args);
    }

    I wanted to know if i could do something similar with SL UnitTest Framework. I want to access my private/internal memembers of the production code assembly in my unit test assembly.

    Thanks for any help.
    -Sudhir

  • http://www.jeff.wilcox.name/ Jeff Wilcox

    @Sudhir,
    The ability to test private types is not available in Silverlight since Silverlight applications are untrusted. The reflection code in the Silverlight BCL will not allow private reflection.

    Although this may be a tough limitation to deal with, do know that some test teams have found private member testing to be very costly, high-maintainence, and not very helpful in the long term.