Game of Tests laravel
This package aims to enable a quick implementation of a Game of Tests in Laravel. Is uses the package swisnl/game-of-tests and gives you a set of commands and basic templates to make your own Game of Tests.
This package serves as a way to search through git repositories and find PHP tests. I was inspired by the the Spotify testing game I ran in to.
The reason i wanted to my own implementation for PHP was to help gamify testing in the company and encourage testing in general in the teams.
- How does it work?
- Available routes
How does it work?
The Game of Tests works by scanning Git repositories and scanning for known test files. It uses Git blame to attribute tests to developers. You can update through multiple artisan commands for Github, bare directories, or single repositories.
I made a demo available which uses this package and show the Game of Tests for the Laravel Github organisation at http://gameoftests.swis.nl. For in information on installing the demo locally, please check out swisnl/game-of-tests-laravel-demo.
- Require this repository
composer require swisnl/game-of-tests-laravel
- Add the service provider to
... \Swis\GotLaravel\Providers\GameOfTestsProvider::class, ...
- Publish and run the migration
php artisan vendor:publish --tag="migrations" php artisan migrate
- (optional) Publish the config and views
php artisan vendor:publish --tag="config" php artisan vendor:publish --tag="views"
This published the config. See Configuration for the available options.
Routes are based on the configuration of route-prefix. Default value is
||List ranking of all time|
||Ranking of the current month. Optionally you can add:
||Ranking of the last [months] months (default 1 month). You can add:
||List of parsed tests of
You have a few commands available to update your data.
Inspect a directory with bare resposities.
Usage: got:inspect-directory [options] [--] <directory> Arguments: directory Options: --skippast[=SKIPPAST] Skip all before (and including) this --modified[=MODIFIED] Repository modified since (uses strtotime) --only[=ONLY] Skip every directory except this one --dry-run Only inspect, do not insert into the database
Inspect a github organisation.
Usage: got:inspect-github [options] [--] <organisation> Arguments: organisation Options: --modified[=MODIFIED] Repository modified since (uses strtotime) --dry-run Only inspect, do not insert into the database
Inspect a Git url.
Usage: got:inspect [options] [--] <repositoryUrl> Arguments: repositoryUrl Options: --dry-run Only inspect, do not insert into the database
Normalize author names based on the config setting.
normalize-names : array
Normalize the names in the array to one single result. Sometimes people are bad with their git name. This will normalize names of committees to the array key.
'Björn Brala' => ['bjorn', 'bbrala']
route-prefix : string
Prefix for Game of Tests routes.
'route-prefix' => 'got'
excluded-filenames : array
What filename should not be included in the statistics. This is database LIKE argument.
'excluded-filenames' => [ 'tests/ExampleTest.php', 'vendor/%', 'tests/_%', ]
excluded-authors : array
What authors should not be included in the statistics. This is database LIKE argument.
cache : boolean (default
Enable caching for GitHub requests so rate limiting is not a problem.
'excluded-authors' => [ 'Automated Commiter', 'System' ]