Tag Archives: TDD

Converting Between Go Unit Test Styles

I’m 4 weeks into a project using the Go language. It’s been an interesting change of pace from my usual Java/Groovy work. There’s a lot to like about Go, but there are some things I miss from Java/Groovy, so the jury is still out for me. (Go is a damn sight better than PHP, that’s for sure.)

Some of us on the project started out using the goCheck extension for unit testing (https://labix.org/gocheck). Others went down the testify path (https://github.com/stretchr/testify). For reasons I won’t go into here, we all just decided to standardize on testify.

To make converting easier, I wrote a SED script that converts “gocheck” style unit tests to “testify” style. At the moment, you can find it in this branch under my fork of testify: https://github.com/polyglot-jones/testify/tree/sed_script/utils

I placed the script in a new “utils” folder that has a README.md with usage instructions.

After my associates finish vetting it, I’ll issue a pull request to see if the testify custodians want to accept responsibility for it.

TDD Slides Posted

Here are the slides (as a PDF file) for the Intro to Test-Driven Development speech that I gave at the SCQAA meeting last night.  I haven’t seen the speaker feedback forms yet, but based on the comments from people walking up to me afterwards, it was an effective speech.  In particular, everyone loved my grand experiment to demonstrate TDD — without requiring any programming knowledge — by having the audience break up into teams and write limericks test-driven.

If enjoyed this speech, then you might also be interested in materials from other speeches that I’ve given in the past.  You can find them on the Downloads page.

Test-First Development Can Be Liberating

Experienced agilists talk about becoming “test infected.”  For everyone, unit testing starts out as a chore that seems like it’s more work than it’s worth, but then you get over a certain hump and suddenly unit testing is a breeze.  The benefits become manifold and profound, and you begin to wonder how you ever programmed without it.

One important milestone on the way to achieving test-infected enlightenment is the transition from test-after to test-first.  All developers start out writing the production code first and then write unit tests around it.  It’s the only way we learn.  But, eventually, we begin to see the power of writing the tests first.  This used to be called Test-Driven Development, but it’s more accurately referred to as just Test-First Development (although we still abbreviate it as TDD).

For me, the greatest thing about TDD is that it gets the subjective part of the problem out of the way early, leaving just the objective part to puzzle out.  “Okay, now that we know what we need to accomplish, we just have to get it to work.”  It’s a rather liberating feeling. Continue reading Test-First Development Can Be Liberating