petrgrishin/parallel-unit-test

Methodology of tests for parallel execution of code

dev-master 2015-03-25 21:19 UTC

This package is not auto-updated.

Last update: 2024-10-30 08:03:27 UTC


README

Methodology of tests for parallel execution of code

Installation

Add a dependency and script to your project's composer.json:

{
    "require": {
        "petrgrishin/parallel-unit-test": "dev-master"
    },
    "scripts": {
      "test:parallel": "/usr/bin/env php vendor/petrgrishin/parallel-unit-test/src/cli.php test:parallel ./home-path-for-tests"
    }
}

Create parallel test

<?php
class SimpleParallelTest extends \PHPUnit_Framework_TestCase{

    /**
     * @group before
     */
    public function testInit() {
        //One run before parallel tests
    }

    /**
     * @group parallel
     */
    public function test() {
        //Will be launched in three parallel streams
        $this->assertTrue(true);
    }
}

Run parallel test

composer test:parallel