Laravel package for a Game of Tests

Overview

Game of Tests laravel

Latest Stable Version License

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?

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.

For now it supports PhpUnit, Codeception and Behat for PHP and Ava, Jasmine, Jest, Mocha, Tape and QUnit for JavaScript and True for SCSS. Feel free to contribute new parsers to swisnl/game-of-tests.

Demo

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.

Author

Created by Björn Brala (@bbrala).

Installation

  1. Require this repository

composer require swisnl/game-of-tests-laravel

  1. Add the service provider to app.php
    ...
    \Swis\GotLaravel\Providers\GameOfTestsProvider::class,
    ...
  1. Publish and run the migration
php artisan vendor:publish --tag="migrations"
php artisan migrate
  1. (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.

Available routes

Routes are based on the configuration of route-prefix. Default value is got.

URL Description
/got List ranking of all time
/got/score-for-month Ranking of the current month. Optionally you can add: ?monthsBack=[months] to go back any amount of months. For example to get the tests of last month: app.url/got/score-for-month?monthsBack=1.
/got/score-for-months-back Ranking of the last [months] months (default 1 month). You can add: ?monthsBack=[months] to go back any amount of months. For example to get the tests of last 3 months: app.url/got/score-for-month?monthsBack=3.
/got/{user} List of parsed tests of {user}. You can add: ?fromMonthsBack=[months] to go back any amount of months. For example to get the tests of last 3 months: app.url/got/bjorn-brala?fromMonthsBack=3, or you can add ?monthsBack=[months] to show results for [months] back. For example to get the tests of last month: app.url/got/bjorn-brala?monthsBack=1.

Commands

You have a few commands available to update your data.

got:inspect-directory

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

got:inspect-github

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

got:inspect

Inspect a Git url.

Usage:
  got:inspect [options] [--] <repositoryUrl>

Arguments:
  repositoryUrl

Options:
      --dry-run   Only inspect, do not insert into the database

got:normalize-names

Normalize author names based on the config setting.

Usage:
  got:normalize-names

Configuration

normalize-names

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.

Example

'Björn Brala' => ['bjorn', 'bbrala']

route-prefix

route-prefix : string

Prefix for Game of Tests routes.

Example

'route-prefix' => 'got'

excluded-remotes

excluded-remotes : array

What remote should not be included in the statistics. This is database LIKE argument.

Example

'excluded-remotes' => [
    '[email protected]:swisnl/test-%',
]

excluded-filenames

excluded-filenames : array

What filename should not be included in the statistics. This is database LIKE argument.

Example

'excluded-filenames' => [
    'tests/ExampleTest.php',
    'vendor/%',
    'tests/_%',
]

excluded-authors

excluded-authors : array

What authors should not be included in the statistics. This is database LIKE argument.

cache

cache : boolean (default true)

Enable caching for GitHub requests so rate limiting is not a problem.

Example

'excluded-authors' => [
    'Automated Commiter',
    'System'
]
You might also like...
🚀 An open source multiplayer space strategy game.
🚀 An open source multiplayer space strategy game.

Badges Introduction The game story takes place in a virtual galaxy where randomly generated planets produce various raw materials which can be used by

A console noughts and crosses game written in php

Tic-tac-toe A console noughts and crosses game written in php To play, simply clone the file Navigate to the file directory on your terminal and run t

Web typing game

Welcome in Typing Game by Cards™ Introduction This game consist of typing 5 french expressions, the fatest you can ! Get Started Clone the repository

SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

SpawnInLobby Pocketmine-MP plugin. With this plugin the player will always join the game at the default world spawn point

Game of life developed in PHP with TDD approach

What is Game of Life: https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life Project structure: Engine is in App\Services\LifeEngine.php Tests are in T

A text-based, persistent browser-based strategy game (PBBG) in a fantasy war setting
A text-based, persistent browser-based strategy game (PBBG) in a fantasy war setting

Note: OpenDominion is still in development. Some features of the game have not been implemented yet. Introduction OpenDominion is a free and open-sour

A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with the word connecting the four images.

4images_1mot_solutions A web app for the resolution of a mobile game in wich you have 4 images and a list of letters, then a few boxes to fill with th

A playable tic-tac-toe game developed with HTML, AJAX, PHP and BladeOne technology

tic-tac-toe Escribe un programa PHP que implemente el juego del tres en raya. La aplicación creará una cuadrícula en la que el jugador podrá introduci

Core functionality for Legend of the Green Dragon, a text-based RPG game.

Legend of the Green Dragon (Core) Legend of the Green Dragon is a text-based RPG originally developed by Eric Stevens and JT Traub as a remake of and

Comments
  • Excluded stuff for got:inspect

    Excluded stuff for got:inspect

    On https://github.com/swisnl/game-of-tests-laravel/blob/64caf0bb919b7b50ad083031e33b1699d7fe64c3/src/Console/Commands/InspectUrl.php#L69 you are excluding lot of important info, which makes final stats useless, why?

    question 
    opened by ostrolucky 5
  • got:inspect: Couldnt insert: filename

    got:inspect: Couldnt insert: filename

    This line https://github.com/swisnl/game-of-tests-laravel/blob/64caf0bb919b7b50ad083031e33b1699d7fe64c3/src/Console/Commands/InspectUrl.php#L69 throws Illuminate\Database\Eloquent\MassAssignmentException (which you are obfuscating for some reason, but whatever)

    It seems you need to specify in your model which fields can be filled, or disable this eloquent protection

    enhancement 
    opened by ostrolucky 3
Releases(3.0.2)
Owner
SWIS
SWIS
A useful PocketMine-MP plugin that allows you to create crates in-game!

ComplexCrates A useful PocketMine-MP plugin that allows you to create crates in-game! Commands Main command: /crate Sub commands: create

Oğuzhan 8 Aug 26, 2021
Game Boy Camera Wifi Photo Extractor

Game Boy Camera Fast Wifi Adapter Plug in your Game Boy Camera, turn it on, and you can have the photos on your phone in under 2 minutes! Why I Made I

Matt G 71 Dec 16, 2022
The game is implemented as an example of scalable and high load architecture combined with modern software development practices

Crossword game The game is implemented as an example of scalable and high load architecture combined with modern software development practices Exampl

Roman 56 Oct 27, 2022
This plugin adds custom pets to game for PocketMine-MP!

ComplexPets A plugin that adds pets to game made by OguzhanUmutlu for PocketMine-MP. Command Simply type /pets and summon your favorite animal! Featur

Oğuzhan 10 Aug 12, 2021
A game-mode for Minecraft: Bedrock Edition

HardCoreFactions This is an unpaid commission that was only released for educational purposes, consider using it as a reference rather than having it

Doge 3 Sep 8, 2021
Rules to detect game engines and other technologies based on Steam depot file lists

SteamDB File Detection Rule Sets This is a set of scripts that are used by SteamDB to make educated guesses about the engine(s) & technology used to b

Steam Database 103 Dec 14, 2022
Encuentra_Al_Puffle-Game Es un juego sencillo, lo cuál desarrollé a modo de práctica y por gusto

Encuentra_Al_Puffle-Game Es un juego sencillo, lo cuál desarrollé a modo de práctica y por gusto. Tomando como referencia a los puffles (frailecillos)

Moises Reyes 4 Dec 27, 2021
Simple game server with php without socket programming. Uses the Api request post(json).

QMA server Simple game server with php without socket programming. Uses the Api request post(json). What does this code do? Register the user as a gue

reza malekpour 3 Sep 4, 2021
Steam store auto add to cart game

Steam store auto add to cart game use it for steam trading card farm How does it work? link.php explode and find link from link.txt and next open all

reza malekpour 3 Sep 4, 2021
Simple KPHP game, a proof of concept thing

KPHP Game About This is a game written in PHP using kphp-sdlite library. Gameplay video: https://www.youtube.com/watch?v=L44l4Tqm4Fc This game feature

Iskander (Alex) Sharipov 26 Dec 19, 2022