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:
Today I'm releasing the code I used to obtain this data: a script called Town Tester.
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
- 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.
- 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.
Also, please don't game the system by adding a "test.txt" file to the root of each of your repositories.