razielsd/parallel-phpunit2

This package is abandoned and no longer maintained. No replacement package was suggested.

Run parallel phpunit tests command line

dev-master 2014-07-25 10:16 UTC

This package is not auto-updated.

Last update: 2019-02-20 17:33:54 UTC


README

New version of parallel phpunit. Test runner is bash-script, control flow - php. Paralleling tests by test file, when using plugin TimeSort - slowest test first.

Features

  • Use PHP, minimum bash
  • Use original PHPUnit file loader for search files, support phpunit.xml
  • Use php for create plugins
  • Flow control from PHP

Basic usage

Use Parallel PHPUnit 2 as PHPUnit:

bin/parallel-phpunit - show help (same PHPUnit)

Configure

Config files in etc/

  • config.php - basic pameters and options
    • src/phpunit/phpunit - path to PHPUnit
    • src/phpunit/php_file_iterator - path PHP_File_Iterator library
    • src/phpunit/php_code_coverage - path to PHP_CodeCoverage library
  • default/phpunit_command - command for execute phpunit, can override from command line parameters
  • default/max_thread - default maximum thread for tests execute, can override from command line parameters
  • plugin - plugin options, use etc/plugin.php

Also you can override config optios by etc/config.local.php (full config rewrite, partial overriding options comming soon)

Example

  • bin/parallel-phpunit Web_FailTest
  • bin/parallel-phpunit Web/debug
  • bin/parallel-phpunit Web/FailTest.php
  • bin/parallel-phpunit --pu-threads 2 --pu-cmd /home/razielsd/projects/project/bin/tests/test.sh --log-junit /tmp/junit.xml --stop-on-error -c ~/projects/tmp/phpunit_conf/phpunit.xml

Plugins

  • FileFilterByGroup - select files with selected group, use --group option
  • NoSeleniumRestart - restart test on lost Selenium(WebDriver) connection)
  • PrintSummary - print test execution info
  • TimeSort - sort test by execution time, longer first.
  • MultiRun - run multiple instances of test

Plugin writing

Create class in lib/Plugin, extends from Core_Plugin, for example see lib/Plugin Plugins can attach to events from Parallel PHPUnit 2:

  • Core_Plugin::EVENT_START - Parallel PHPUnit started
  • Core_Plugin::EVENT_AFTER_READ_FILES - File for tests selected
  • Core_Plugin::EVENT_AFTER_TEST_FAIL - test failed
  • Core_plugin::EVENT_FINISH - all tests finished Detailed info is comming soon ...