Saturday, August 18, 2012

Introducing .net SmokeTest for Windows

Introducing .net SmokeTest for Windows 

The idea for SmokeTest came to me while working on a project to create an API for clients. It's easy enough to create an API but to test it thoroughly, beyond unit testing, is a bigger task. Generally you need to create a small test app in code to call the function of interest with all type and values of arguments and check and report the return values. That's a lot of repetitive work especially when the API requires "setup" or "login" procedures before they are functional. There has got to be a better way.

Where there's smoke there's fire!
The first improvement was to create a monolithic test application that would let you navigate to any of the implemented functions and run the test suite for that function. Now you only have to do the setup once. The down-side is that you need to add a new test suite for every new API function and decide if it should share the code from an existing test or create a new one, doable but still a lot of work and not guaranteed to be in sync with your latest and greatest API.

Aha, Reflection
It then occurred to me that I could use .net reflection to discover all the namespaces and classes therein then present a tree of member functions that would always be up-to-date. Now we would just need to write a small "plug-in" that could be invoked for the function under test. Hey, now we're getting somewhere. A single app that is in sync with the API at all times and a small plug-in architecture to test each function. After toying with this concept for a short time the idea of creating and maintaining a plug-in architecture seemed daunting and overkill.

Reflected Arguments
The clincher was the realization that even the arguments and argument types for each member function are available via reflection. So now I could leverage reflection to determine the number and types of arguments to each function. The trick was to come up with a user interface that was easy to use and flexible enough to support any and all argument types.

So armed with a couple of weeks of free time on a cruise ship to Hawaii I decided to code the prototype for proof-of-concept. The result of those efforts was the first release of .net SmokeTest for Windows.

This first version only supported simple argument types like int, double and string. For most applications this covers a lot of the API and proved to be very useful indeed. Developers, QA and managers began using it when it was appropriate. It freed up developer's time since they no longer had to create a separate app to demonstrate the functionality. QA was more productive since they could test every edge condition rather than just what the developers decided to include and management started using it to debug support issues. All in all a useful tool across the board.

This is a real hands-on product. The best way to appreciate it's power is to try it out on your favorite Assembly, so go ahead and download it now, it's FREE. There is still a lot of room for features and enhancements. Here you'll find a list of stories I'm working on and some ideas for new features. Let me know if you have any suggestions or any thoughts you have.


No comments:

Post a Comment