In my last post I wrote about a concept plus a rough hack for turning test coverage into a game. The short of it is that tests are generally boring, and a possible way to encourage team members to write more tests is to turn test coverage into a game by simply publicly displaying the top testers (by test coverage). The overall goal is to increase code quality in your organization.
So I ended up packaging my previous code into a public package. The idea is that you can pip install it, adjust a few settings, run it, and blammo, the results are publicly visible on the internets.
I also installed another popular repo, thefuck, and ran tests for that. Results are as follows:
And finally, the results of the requests library:
I had an interesting dilemma: test coverage percent matters, but 90% test coverage on 100 lines of code is surely different from 80% test coverage on 10,000 lines. So I ended up only displaying 3 possible states: fewer than 500 lines, fewer than 10,000 lines, or greater than 10,000 lines. The reason was this project was meant to be a game, and so I didn’t want to incentivize line count. This is largely accepted to not mean all that much. However, with the rules set up, it was very easy for an intern who only wrote a little bit of code to rank at the top. The line counts at least allow you to put the test coverage into some context.
Right now you can install the test coverage module with:
The rest of the instructions are found on the repo’s README
Ironically, there is currently no test coverage on the test coverage module. If you open pull requests, and they are awesome, I will merge them.
The Web App
Currently, I have a simple web application running at test-coverage-game.herokuapp.com. Also, there’s no landing page for it. If you’re going to kill me for it that’s fine. It’s still a work in progress.