Thoughts on Software and Technology

Don’t be an idiot like me, mock your services!

You know the old saying, a derivative of: “Test are like flossing, we all know we should write them, but no-one does.” That’s an old saying because, while it was true 10-20 years ago, it’s not so true now. For the most part, the modern development world is a beautifully tested one. These days, nearly everyone flosses.

Still, there are always improvements. Sure, we test, but maybe we don’t really test the web interactions, or test the controllers as well as we should, or whatever. We’re flossing, but we’re not really flossing as well as we could be. We’re missing some teeth.

Today, I got a toothache.

Mock your services

My company, Hydrasi, has what is a fairly common architecture these days. We have a front-end website (in Rails) that sessions users and does various pretty things, and we have various back-end servers (our main is in Scala) that do things like manage data, send messages, etc. Everything connects to everything else via messaging and API calls. This is basic “concern separated” design. The Rails site shouldn’t care what the hell happens in the Scala server, it should just care that when it says “give me a monkey,” it get’s a monkey. It’s a nice separation because I “own” the front end, and my partner “owns” the back end.

And yet, with all of this architectural decision making and best practices, today I’m at a work-stoppage point because my front-end tests are failing. Why? Because I’m an idiot and built them all while I had a back-end server that was functional. Today, that service is *not* functional, and my partner is out, probably doing what he should be doing on a Saturday– having fun.

Yes, I feel really stupid. I spent an hour trying to hack around and get the back-end services running so I could work.

Yes, I already feel stupid, and yes, it’s obvious that I haven’t really been flossing.

So now, instead of working on what I thought I was going to work on, I’m heading over to grab the FakeWeb gem so that next time I work, it won’t matter whether any other servers are running.

(in a month, I’ll write a post about how I forgot to write integration tests :)

Comments are closed.

Powered by WordPress | Designed by Elegant Themes