Accountability: The Ultimate Motivator

A coworker and I recently decided to start open sourcing some of the small pluggable Django apps we've been using and reusing for different projects at work.  One of these apps was django-cms-redirects, a project based off of django.contrib.redirects, but that integrates with Django CMS' Page objects.  When we'd finished packaging the app up and got it pip installing from pypi we excited posted in the #django-cms IRC channel with a link to the github repo and asked for some feedback.  The general response from the folks on IRC was "this is great, but where are the unit tests?"  

Give a mouse a cookie...

...and he'll keep you accountable.  I've written unit tests before using nUnit, back in my C# days, and I've read through the Django docs on Unit Testing, but I've only ever written a handful of unit tests for my Django projects, even though it's so easy to get started with them.  It's not about knowing how, and it's not an issue of wanting to, because I want to follow best practices and have people like me (or at least not hate me when they have to take over maintaining my code).  

In the end it's an issue of motivation.  No amount of good intentions would ever get those unit tests written, it takes someone expecting me to write thurough unit tests for my code to get me to actually do it.  Some people react badly to responsibiltiy, but (as my wife will tell you) I do really well if I have a to do list, because I know what's expected of me and I get a great deal of satisfaction from being able to visually see and check off what I've accomplished.  So for me, accountability is what I need to get me to write unit tests.

Who's keeping you accountable?

So if you're like me, and you need some motivation to help you get those unit test written, find someone who will keep you accountable.  If it's an open source project, you can leverage the community to help keep you accountable.  I've found it to be especially true within the Django and Python communities, that they expect you to have passing unit tests for your project, or face public shaming.  

If you're part of a team, and if unit tests are important to you (which they should be), then you need to commit as a team to hold each other accountable for not only the code that you write, but also the unit tests to show that the code works.


Next entry

Previous entry

Similar entries