BDD UI Automation with Specflow and Coded UI Tests « Ryan Burnham's Blog. As a tester in a Scrum development environment when I heard about Specflow and Behaviour Driven Development I started to wonder if we could use the Specflow Gerkin format to specify our acceptance criteria for a User Story and then be able to wire this up to a coded UI Test to prove that we have actually added this feature and to ensure that it will not break in the future. After a bit of research and a good understanding of Coded UI test and Specflow I found it actually wasn’t that hard to do. So why would I do this? Specflow tests are normally aimed around the ViewModel layer; this is fine if you’re using a good architecture but what about older legacy products.Normal Specflow tests do not test exactly what the user will experience.Unfortunately Coded UI Tests have been known to be brittle and this is defiantly something you need to be aware of. With older technology Coded UI Tests uses MSAA (Microsoft Active Accessibility) to find property values of a control.
SpecFlow 1.6 Like this: Testing the User Interface with Automated UI Tests. Automated tests that drive your application through its user interface (UI) are known as coded UI tests (CUITs). These tests include functional testing of the UI controls. They let you verify that the whole application, including its user interface, is functioning correctly. Coded UI Tests are particularly useful where there is validation or other logic in the user interface, for example in a web page. They are also frequently used to automate an existing manual test. As shown in the following illustration, a typical development experience might be one where, initially, you simply build your application (F5) and click through the UI controls to verify that things are working correctly.
You then might decide to create a coded test so that you don’t need to continue to test the application manually. Creating a coded UI test is easy. Alternatively, if you have a test case that was recorded in Microsoft Test Manager, you can generate code from that. Requirements In this topic. Design your Silverlight application for TDD ! There is one major flaw you must have encountered whilst working with Silverlight for a while: its incompatibility with unit tests! Unless you’ve been using Silverlight solely for drawing circles and rectangles, surely you must have tried to use the Silverlight Toolkit unit test project template to try to put some TDD in your project !
…most probably you were disappointed by it because it’s fairly poor… This project is specific to Silverlight (the Microsoft test assembly is specific)Running tests is only possible by launching the test application wrapping up your test classes. And let’s be frank, the usability of this interface is quite poor. All those issues can find an explanation in the fact that the Silverlight framework is a subset of the .NET one making them incompatible with each other. However, even though these frameworks are different, they’re also very similar.
First, architecture your projects One of the major secrets of a long running application resides in its architecture. Silverlight UIAutomation Testing -- Using WatiN to navigate to a page and White to test a Silverlight app. I had the need recently to automate testing of a Silverlight app and ran into a problem using white (could anyone have come up with a more difficult name to search on?) Where white does not provide functionality to get a reference to a hyperlink in the DOM and click it in the way that, for example, WatiN does. The scenario where this came up is there is a web app with a landing page that has a link to the page hosting the Silverlight app and we need to click through the link into the Silverlight hosting page. I briefly thought about just cribbing the functionality from WatiN and extending white's capabilities but quickly discarded that idea as too complicated and out of concern that it would become a maintenance nightmare.
The solution I came up with is to use WatiN and white together in a hybrid fashion, where WatiN spins up a browser instance and then white attaches to that browser instance using the ProcessID of the instance from WatiN. White - Downloads. Combine WatiN and White to test Silverlight. Jeff Wilcox – NUnit & the Silverlight unit test framework. Did you know that you can run NUnit tests with the Silverlight unit test framework? In this short guide, I talk about updating NUnit to build for Silverlight, wiring up test projects, and a download with everything you need to get started. This isn’t a "metadata redirection" trick – but the actual NUnit assertions and metadata running inside the Silverlight unit test engine.
This took about 15 minutes to implement from start to finish – shorter than the amount of time it’ll take me to publish this post. Though NUnit is great for legacy components and tests, I strongly recommend using the for most projects. That said, I do hear about legacy business objects and NUnit tests that devs would like to be able to verify and run in the browser + Silverlight environment.
You can read about NUnit attributes and assertions in the official documentation. Running sample & validation tests that ship with NUnit Silverlight unit test framework is easy to extend OK. Getting NUnitFramework to build.