Profile avatar

Matt Steele

Town Tester - How well does your city unit test?

Sep 18, 2012

In my talk Zen and the Art of TDD, I included a slide that showed only 43% of all Github repositories from Omaha developers included unit tests:

Languages

Today I'm releasing the code I used to obtain this data: a script called Town Tester.

View town-tester on Github

It's a Ruby script that queries the Github API to do the following tasks:

  • Find users with their Location set to the value you provide
  • Clones all "popular" repos (not a dotfiles project, at least 1 watcher, not a fork)
  • Checks for the existence of tests (based on a filename that includes "test" or "spec")
  • Creates a .csv with data on each repo, and prints statistics broken down by language
I'm excited for the possibilities of this project:
  • Want to showcase how awesome your local community is? Steal developers away from San Francisco by proving your city can test better than their piddling 56% rate.
  • Put an end to the Great Semicolon Debates. Whichever developer has more JavaScript repositories with tests wins all syntax arguments by default!
  • Gamification is all the rage. Why not track your city's testing ratio over time, and give XP to developers that increase the ratio the most? Each month, the winner could get free drinks at your local Beer && Code.
  • Just in time for the Global Day of Coderetreat, you could lure Corey Haines to your hometown by being the best tested city in the world. I'm pretty sure he doesn't really want to go to Sydney or Honolulu anyway.
I know I'm just scratching the surface of this venture.

Also, please don't game the system by adding a "test.txt" file to the root of each of your repositories.