StatLight Documentation

How does it work?

StatLight is a console application that creates an in memory web server. It starts up a web browser that will request from the web server a page containing your test xap. By executing all the tests in the browser and communicating test results back to the web server. The console now has the ability to publish those results in manners not allowed in the Silverlight sandbox.



Continuous Integration

  • Platforms
  • Are my tests running UI tests? (using the TestPanel in the Microsoft.Silverlight.Testing framework)
    • No
      • You should be find just calling StatLight as you would normally in a build script.
    • Yes
      • The server's "agent" process must run with access to the desktop.
        • In older versions of windows you can do this making the service process run under the "Local System account" and selecting the "Allow service to interact with the desktop"
        • ServiceConfig.PNG
        • In newer versions of windows (or if you need to run the service with a domain account). You will have to look at how to run the agent's service application under a domain account.
          • Auto-login an account to the console
          • Setup the integration service process to run at start. (This will be different for TeamCity, TFS, CruiseControl.Net (or other))
  • Take a look at the following to get your build agents running under a domain account

Local Development


In the 1.4 release of StatLight I added a very basic extensibility model. Read more on the Extensibility Documentation.

Command Line Options

Shortcut Full Description
-x --XapPath The path to the xap you would like to test. You can specify multiple xaps to test EX: StatLight.exe -x="C:\Project1\Test1.xap" -x="C:\Project1\Test2.xap"
-d --DllPath The path to the dll you would like to test. You can specify multiple dlls to test EX: StatLight.exe -d="C:\Project1\Test1.dll" -d="C:\Project1\Test2.dll"
-t --TagFilters If you use the Microsoft.Silverlight.Testing framework. You can specify your tag filters using this option.
-c --Continuous Runs a single test run, and then monitors the xap for build changes and re-runs the tests automatically.
-b --BrowserWindow Sets the display visibility and/or size of the StatLight browser window. Leave blank to keep browser window hidden. Specify this flag to have the browser window shown with the default height/width. Or using the following pattern [M|m|n][HEIGHTxWIDTH] you can specify the window state [M|Maximized|m|Minimized|N|Normal][HEIGHTxWIDTH] to be able to specify a specific size. EX: - b:N800x600 a normal window with a width of 800 and height of 600.
--MethodsToTest Semicolon seperated list of full method names to execute. EX: --methodsToTest="RootNamespace.ChildNamespace.ClassName.MethodUnderTest;RootNamespace.ChildNamespace.ClassName.Method2UnderTest;"
-o --OverrideTestProvider You shouldn't have to use this because StatLight will automatically detect what you are using. There are cases that you will have to help StatLight out. This option allows you to override the default test provider of MSTest. Pass in one of the following [Undefined | MSTest | XUnitLight | Xunit | NUnit | UnitDriven | MSTestWithCustomProvider]" Note the MSTestWithCustomProvider option will instruct StatLight not use any of it's own providers and search your test assemblies for an IUnitTestProvider (EX:Raven Custom provider]
-v --Version Depricated - StatLight automatically figures out what version of the MSTest assembly. Specify a specific Microsoft.Silverlight.Testing build version. Pass in one of the following [December2008 | March2009 | July2009 | October2009 | November2009 | March2010 | April2010 | May2010 | Feb2011]
-r --ReportOutputFile File path to write the report specified by the --ReportOutputFileType option.
--ReportOutputFileType Specify the type of report output when using the --ReportOutputFile. Possible options "{[StatLight | MSGenericTest | NUnit | TRX]"}
--UseRemoteTestPage This'll throw a NotImplementedException. (Experimental idea that's been ripped out at some point. Could potentially put back, but haven't found a good reason)
--WebBrowserType Experimental If you have other browser installed, you can have StatLight use any of the following web browsers [SelfHosted | Firefox | Chrome]
--ForceBrowserStart You may need use this option (in conjunction with --WebBrowserType) to give permission for StatLight to forcefully close external web browser processes before starting a test run.
--NumberOfBrowserHosts Default is 1. Allows you to specify the number of browser windows to spread work across. This can break 1000 tests up into 2 browsers and cut the test time nearly in half. (Play with the number depending on your test suite size. More than 5 here can consume way too much memory. (usually between 2-4 is a good number)
--QueryString Pass configuration into your test xap
--debug Turns on the extra tracing that can provide some clues into why StatLight may be having issues. (Note: this is not pretty output...)
--teamcity TeamCity Integration
--MSGenericTestFormat This option has been replaced. Use the --ReportOutputFileType:MSGenericTestFormat
--webserveronly Starts up the StatLight web server without any browser. Useful when needing to attach Visual Studio Debugger to the browser and debug a test.
--OverrideSetting Specify settings to overried at the command line. "{[EX: --OverrideSetting:MaxWaitTimeAllowedBeforeCommunicationErrorSent=00:00:20]"}
-? --help Prints much of what's above to the console

Last edited Dec 26, 2011 at 4:23 AM by staxmanade, version 42


No comments yet.