Writing Tests To Be Read*
Good unit tests can help ensure that your code doesn't break; Great unit tests can teach people how to use it. In this session, you'll learn some tips for making tests readable enough that developers consult them as documentation.
Good unit tests can help ensure that your code doesn’t break; Great unit tests can teach people how to use it. In this session, you’ll learn some tips for making clear, readable tests. The session will cover three general areas, with copious (but brief!) code examples:
- Keeping Out Clutter: Techniques for keeping tests focused on their core topic, and leaving out or hiding details that don’t matter.
- Putting It In Context: Techniques for using naming patterns and test structure to emphasize the problem domain of your code, rather than the mechanics of test setup.
- Telling a Story: Techniques for organizing larger groups of tests to tell developers what they most need to know.
Throughout the session, there will be a focus on short, memorable advice, and on realistic code examples.
unit testing, tdd, documentation
I've spoken at the Agile Conference in 2010 and 2012, at Agile Games in Boston in 2012, and several times at local groups around Boston. Alas, none of these talks were recorded.
I've given variations on this talk to development teams at Cyrus, where I work, but I haven't previously given it in public.
Moss lives in Boston, MA, where he works for Luminoso as a Python developer. His particular passion is working to make code so readable it invites people to use and change it. He has a growing interest in teaching development skills, and in finding ways to make the art of programming more inviting and accessible to newcomers.
- Title: How I Learned Haskell by Writing Tiny Games
- Track: Hacks
- Room: B304
- Time: 4:45 – 5:30pm
Earlier this year, I started teaching myself Haskell by using it to write short, text-based games. In this session I’ll share what I learned, both about Haskell and about learning new things.
- Speakers: Moss Collum