Question

We use SpecFlow with Selenium successfully to test our HTML applications and are looking for a similar way to test our Silverlight applications. At the moment, we are assessing these options:

  • SpecFlow Silverlight with Microsoft Silverlight unit test framework
  • Normal SpecFlow using Telerik WebAii

Has anyone tried these approaches? Can Microsoft framework test UI elements (eg click on button, assert on text value)? Are there other options?

Was it helpful?

Solution

I created a blog entry for Silverlight Unit Testing and specflow here http://rburnham.wordpress.com/2011/05/13/testing-silverlight-asynchronous-code-with-specflow/ just note that this was a pre release built, they may have changed the syntax a bit.

but it sounds like your after UI Tests. You can use the Coded UI Tests with specflow to achieve this. I wrote a series on this as well http://rburnham.wordpress.com/2011/03/15/bdd-ui-automation-with-specflow-and-coded-ui-tests/

To summorise you would need to do the following

  1. Create a Test Project
  2. Set up specflow for that project
  3. Add a reference to your silverlight app (not the test project) for SilverlightUIAutomationHelper.dll. This allows the Coded UI Test to hook into the silverlight app
  4. Now getting them to work together is basically the same as by second link

Just a note though Coded UI Tests do not work with out of browser silverlight apps and i think its only silverlight 4.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top