This project is read-only.


StatLight is an open-source test runner that can execute Silverlight unit tests and report results as an XML file. It supports tests decorated using MSTest attributes, used as default by Silverlight Unit Testing Framework, and can generate results file in the MS Test format.

Some other most important features:
  • It is very easy to deply - all you have to do is to unzip the downloaded file.
  • StatLight is just an executable, so it is easy to integrate with any build system.
  • It supports tests created using other unit testing frameworks, such as NUnit, UnitDriven and XUnit
  • It can automatically close windows created by MessageBox.Show and assertions. As we learnt in the Silverlight team, this is must-have feature for any test runner.
  • It can run tests in Firefox and Chrome.


Project website:
License: Microsoft Public License (
Integrating StatLight with TFS test system:


Running from command line

StatLight.exe -x bin\debug\SilverMindMap.Core.Tests.xap

Using Chrome or Firefox to run tests

StatLight.exe -x bin\debug\SilverMindMap.Core.Tests.xap -b=Chrome
StatLight.exe -x bin\debug\SilverMindMap.Core.Tests.xap -b=Firefox

Running only tests with tag "Priority0"

StatLight.exe -x bin\debug\SilverMindMap.Core.Tests.xap -t=Priority0

Integration with MsBuild

You can use the Exec task to execute StatLight.exe and run you unit tests. The Silver Mind Map project defines a new Target that uses StatLight to run unit tests:
    This target runs unit tests created with Silverlight Unit Test Framework 
    Used properties:
      TestXapFile:    path to the XAP file with unit tests
      TestResultFile: path where the XML result file will be saved.
      TagFilters:     (optional) additional tag filter expression for the Silverlight Unit Test Framework.
    This target succeeds only when all tests pass.
<Target Name="RunUnitTests"
      <TagFiltersArgument Condition="'$(TagFilters)' != ''">-t=$(TagFilters)</TagFiltersArgument>
      <StatLightCommandLine>$(StatLightPath) $(XapFileArgument) $(ResultFileArgument) $(TagFiltersArgument)</StatLightCommandLine>
    <Exec Command="$(StatLightCommandLine)" ContinueOnError="false"/>

This task is invoked after each build of the SilverMindMap.Tests.targets. Notice the TagFilters property - in this case, it is used to run only tests tagged as BVT after each build.

<!-- Properties used by unit tests -->
    <TagFilters Condition="'$(TagFilters)' == ''">BVT</TagFilters>

<!-- Extending the Build target and running Priority0 unit tests after each build -->
<Import Project="$(SolutionDir)\BuildScripts\SilverMindMap.Tests.targets" />  

Last edited May 18, 2011 at 12:01 PM by _incognito_, version 4


No comments yet.