Skip to content

Instantly share code, notes, and snippets.

@jkulak
Created July 5, 2011 08:33
Show Gist options
  • Save jkulak/1064487 to your computer and use it in GitHub Desktop.
Save jkulak/1064487 to your computer and use it in GitHub Desktop.
Randomize your PHP unit tests order by adding a shuffle.
<?php
/**
* @author
*/
require_once 'Config.php';
class AllTests {
public static function suite() {
$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
$tests = array(
'FirstFileWithTest',
'SecondFileWithTest',
'ThirdFileWithTest',
'AndSoOnTest'
);
// randomize test order
shuffle($tests);
foreach ($tests as $key => $value) {
echo "[$key] $value \n";
require_once $value . '.php';
$suite->addTestSuite($value);
}
return $suite;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment