Jeff Wilcox (who developed the Silverlight unit test framework
and harness) has a great blog post that talks about how to add a Silverlight
Unit Test project to a solution here. You can download the chat application that he shows
testing from this expression blend blog post tutorial I did last
month. You can also watch this cool video post that Jeff created where he walks
through the unit test framework and test cases we've shipped.
As Jeff shows in his post, you can now add a
"Silverlight Test Project" to your Visual Studio solution which
encapsulates unit tests for an application you are working on:
Figure 1
You can then add unit test classes to the test project that
test APIs or simulate UI action within the Silverlight controls (simulate
button clicks, etc).
Figure 2
You can then run the test project and execute
the tests within it to verify and report their status.
Jeff's test framework automatically provides a
browser based test harness and reporting system (which means you can run it on
any browser/OS combination that Silverlight runs on):
Figure 3
Jeff's test framework supports quickly
re-setting controls after each test (and avoids needing to re-launch a new
browser instance for each test cases - which makes it really fast).
You can quickly rip through hundreds or
thousands of automated tests in seconds:
Figure 4
Green results mean the tests passed. Red results flag
that a test case failed and log the assertion failure and/or runtime exceptions
that occurred.