Silveright UI testing with SpecFlow
-
22-10-2019 - |
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?
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
- Create a Test Project
- Set up specflow for that project
- 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
- 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.