Windows Phone 7 Support
Note: Windows Phone 7 support has not been migrated to SpecFlow v2. Silverlight projects needs to be tested with SpecFlow 1.9.
You can use SpecFlow for developing Windows Phone 7 applications. Just do these simple steps.
Note: there are some issues reported when using Windows Phone Developer Tools 7.1 Beta, see SpecFlow forum for details
(Windows Phone 7 support for SpecFlow was done by Max Paulousky http://www.maxpaulousky.com)
- Windows Phone Developer Tools RTW
- Windows Phone Developer Tools January 2011 Update (optional)
- Silverlight Unit Test Framework
Create unit test project
- You can find a good description about this at http://www.smartypantscoding.com/a-cheat-sheet-for-unit-testing-silverlight-apps-on-windows-phone-7
SpecFlow runtime for WP7
- Add a reference to
TechTalk.Specflow.WindowsPhone7.dllto the test project.
- Add an app.config to the project (even if it’s not supported by WP7), with the following content:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/> </configSections> <specFlow> <unitTestProvider name="MsTest.WindowsPhone7"/> </specFlow> </configuration>
Start writing specs
Add feature files and step definitions to the test project. You can use the templates in “Add → New Item…” for that.
Run your tests
Set the project as a startup one and execute it. If you use a device, unlock the screen before starting tests. You should see the result of the test execution displayed on the screen of your device or simulator.
SpecFlow WP7 sample
See BowlingKata-WindowsPhone7-MsTest project as a Windows Phone 7 example.