Codeception / robo-paracept

Robo tasks for Codeception tests parallel execution
MIT License
57 stars 59 forks source link

new feature: filter by codeception group #22

Closed ngraf closed 3 years ago

ngraf commented 7 years ago

Hi, when I executed my codeception tests in parallel it is a common scenario that I only what to execute a specific codeception group (f.e. "smoke", "regression"). I added this feature. I know it's a bit confusing because the word "group" is also used in the context of how paracept divides the tests to be executed into group files.

Example how to use it in console:

robo parallel:split-tests -g smoke

Example how to use it in Robofile

class RoboFile extends \Robo\Tasks
{
    use \Codeception\Task\SplitTestsByGroups;

    public function parallelSplitTests($opts = ['processes|p' => self::PROCESSES_DEFAULT, 'group|g' => ''])
    {
        $testSplitter = $this->taskSplitTestsByGroups($opts['processes']);
        if (false === empty($opts['group'])) {
            $testSplitter->filterByGroup($opts['group']);
        }

        return $testSplitter
            ->groupsTo($this->groupsTo)
            ->run();
    }
}