~2 weeks for the initial build (final months of a Consid AB engagement)
Replacing a Test Framework with a Better Model
Senior Developer — test infrastructure
- .NET
- WPF
- REST API
- Automated testing
Replaced a two-year effort to build a UI test framework for a WPF insurance-claims system with a purpose-built test application that directly hosted and drove the component under test.
Team
- Senior Developer within Trygg-Hansa's development team, via a consultancy engagement with Consid AB
- Participated in sprint planning and technical/design discussions
Challenge
The team needed to run system-level tests against a WPF claims-management application. A separate group of about five developers had spent roughly two years building a framework that executed tests against the running app, observing UI interactions in a way that resembled conventional automated tests.
In practice the framework had real limitations — some UI interactions couldn't be automated reliably (a message box, for example, couldn't be interacted with), along with other compatibility problems. I was asked to investigate and try to get the existing approach working.
Solution
Rather than chasing the framework's individual limitations, I questioned the assumption behind it: did the system need to be tested through a conventional external test framework at all? The application, its WPF components, and the API were all under our control, which opened up a different approach.
I built a separate application specifically for system testing that directly hosted and interacted with the WPF component under test — since it was part of our own .NET application, I had direct access to its runtime behavior instead of treating it as a black box.
I implemented a mechanism for locating UI elements through properties attached to the WPF components, recursively navigating the component hierarchy until a test's target control was found, so the test app could interact directly with buttons, dropdowns, and other elements — including ones the original framework couldn't handle, like message boxes.
The trade-off was giving up some conveniences of defining tests in a conventional unit-testing environment; in exchange, we got complete control over the component being tested. The existing approach had assumed we needed to test through a testing framework — the actual requirement was to reliably interact with the application and verify its behavior. Once that distinction was made, a much simpler architecture became possible.
I built the initial solution alone over about two weeks, then demonstrated it to the team after the Christmas period, incorporated feedback, and extended it further.
Result
The resulting solution gave the team the level of direct control over the WPF application that the original two-year effort had struggled to provide. The team lead was impressed, and the developers behind the original framework wanted to discuss the approach — a conversation that ultimately didn't happen before my engagement ended, so I can't claim it replaced or was formally adopted in place of the original system.
What I can say is that I took a problem that had resisted a large amount of prior development effort, questioned the assumptions behind the existing solution, and produced a working alternative in about two weeks.
The lasting lesson wasn't that the original developers were incapable, or that my alternative was inherently more sophisticated — the difference was in how the problem was framed. Good engineering is often less about finding a cleverer way to implement an existing approach, and more about recognizing when the approach itself is unnecessary.
