Custom Developer Testing Frameworks – A Practical Approach Yuval Mazor, Sela
About Me Senior ALM Sela Writing software professionally since 1998 TFS MCP Co-/Author of Microsoft Training Kits & Courses Co-Manager, Microsoft Israel ALM User Group
Agenda Unit Tests and Parachutes Company C - A Story The Concept of Environment Tests Gallio – The Tool We Use Company C Issues & Demos Summary
Building Software Products is like Jumping Out of an Aircraft…
Unit Tests – A General Parachute
Unit Tests – A General Parachute? Only goes so far! Sometimes it just isn’t enough
The Ballad of Company C VERY successful ISV ~80 R&D Staff Code base is a mess –Duplication –Big Ball-o-Mud – Want to change, but don’t know where to start
Working at Company C New features take AGES to complete Builds fail often (like, REALLY often) Even when they don’t, the application often doesn’t run
? ?
Environment Tests It might build, but it won’t run Test for proper environment conditions (before build!) If you know it won’t run, don’t try to build it (fail fast, fail often) Let’s build an environment-testing framework!
Enter Gallio Open-Source test-framework framework (meta-framework?) The basis for the MbUnit test framework Available at unit/ unit/ (or via NuGet)
When the Build Fails, Don ’ t Go Tellin ’ Tales Problem 1
Explanation Developers work in their own personal universe –a.k.a: But it works on my machine!! And the inevitable result:
Yuval… The Build ’ s Failing Again.. FIX IT!!!
We Want! For every test, describe exactly what can make it fail Make this a required part of the test
Problem 1 Summary Base Class: TestTypePatternAttribute Chain: SetUpTestInstanceChain
The Woes of the XML You Didn ’ t Close Problem 2
Explanation Lots and lots and lots of XML files for customer and feature configuration Used by a variety of tools both during build and runtime Developers edit those XML files frequently –In Notepad –… and check-in invalid files
Why is Tool X giving me these weird errors?
We Demand! Check every XML file in a specific directory for validity Determine which XML file(s) are bad
Problem 2 Summary Base Class: TestDecoratorPatternAttribute Chain: InitializeTestInstanceChain
Put the Blame on the Name Problem 3
Explanation The application uses many small images Image file names need to adhere to specific patterns and rules Developers tend to forget the rules
I ’ m not seeing the correct image here !!
We Require! Check every image file in a specific directory for pattern compliance Determine which image files will not be displayed
Problem 3 Summary Base Class: ContributionMethodPatternAttribute Chain: SetUpTestInstanceChain
Summary Gallio is a framework for developing testing frameworks and tools We used Gallio for developing an environment-testing framework Company C personnel can now rest (a little) easier!
Links Gallio: Source Code:
Thank