Welcome to the Testing Game! A simple script that counts the number of Objective-C, Java, C++ or python unit tests in the current working directory within a git repository, and showcases a ranking based on the percentage each developer has written.
Example output:
Total Tests: 2694
-------------------------------------------
1. Ellie Goulding , 659 (24.46%)
2. Bruno Mars, 255 (9.47%)
3. Ed Sheeran, 250 (9.28%)
4. Sam Smith, 199 (7.39%)
5. Calvin Harris, 147 (5.46%)
This script was made to “gameify” testing at Spotify and to continue encouraging Test-Driven Development.
The script uses the current working directory to find files it could possibly read (such as .m
, .mm
and .java
files) and performs a git blame
on these files in order to match tests written to the developers that wrote them.
The owner of the method name of the test is considered the developer that wrote it.
Note that since this script makes use of git, the file will need to be committed before it is counted. This will always look on the currently checked out branch.
- python 2.7.9 (for running the script)
- git 2.5.3 (for finding the blame information for a given file)
The script should run on any operating system containing these two dependencies. The script may operate on lower python or git versions, but there is a certain of amount of buyer beware here.
-
Run the Python setup.py from this repository:
> python setup.py install
-
Run the testing game script from your repository (or subdirectory):
> testinggame
-
Mention that you write most unit units of your project on every meeting (no, don’t do that).
Yes please! Contributions are always welcomed, have a look at the CONTRIBUTING.md document for more information.
See the project’s contributors page.
This repository is licensed under an Apache 2 license.