Grummle

Blog
Résumé

Inline Sensing Variables

Ok, stop me if you've heard this one. Use Assertions in prod code to make sure your new code is doing the same thing as your old code.

I first read about sensing variables in this book, but honestly was such a newbie they really didn't register. For some reason today it dawns on me that I should revisit the subject. It was prolly the pile of legacy shiat I've got to make some rather major changes to that inspired me. Anyway over to Michael Feathers for info about sensing variables. He's also got a nifty framework for it, but its for java :( I figured I'd implement then manually for now. That wouldn't work either.

If your app, like mine, only lends itself to acceptance testing its kinda hard to implement sensing variables. You can't test it so you can't test the sensing variables. Well thats not gonna work. So what if you just add your new code and leave the old code then add assertions to make sure you new code is giving you the same thing as the old code was. I've got some acceptance tests setup so every time I run those these tests will get exercised as well. Seems like a win-win.

Anyway thats the jist what I'm going to do. Hopefully using assertions I'll be able to get it all broken out into testable chunks and they will no longer be needed at all.

BTW if you know of anybody else doing something like this or someone who thinks its stupid let me know.

I did some quick searches and came up with this tid bit. Its how to find what tests exercise a given piece of code. Kinda neat I thought. http://feedbackjunkies.com/2009/09/inline-assertion-templates-for-eclipse.html
comments powered by Disqus