PHP code example of codeception / robo-paracept

1. Go to this page and download the library: Download codeception/robo-paracept library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codeception / robo-paracept example snippets




e_once 'vendor/codeception/codeception/autoload.php';

class RoboFile extends \Robo\Tasks
{
    use Codeception\Task\Merger\ReportMerger;
    use Codeception\Task\Splitter\TestsSplitterTrait;
}

$result = $this->taskSplitTestsByGroups(5)
    ->testsFrom('tests/acceptance')
    ->projectRoot('.')
    ->groupsTo('tests/_data/group_')
    ->run();

// task returns a result which contains information about processed data:
// optionally check result data   
if ($result->wasSuccessful()) {
    $groups = $result['groups'];
    $tests = $result['tests'];
    $filenames = $result['files'];
}

$result = $this->taskSplitTestFilesByGroups(5)
   ->testsFrom('tests')
   ->groupsTo('tests/_data/paratest_')
   ->run();

// optionally check result data
if ($result->wasSuccessful()) {
    $filenames = $result['files'];
}   

$result = $this->taskSplitTestsByTime(5)
    ->testsFrom('tests/acceptance')
    ->projectRoot('.')
    ->groupsTo('tests/_data/group_')
    ->run();

// optionally check result data
if ($result->wasSuccessful()) {
    $filenames = $result['files'];
}

$this->taskMergeFailedTestsReports()
    ->fromPathWithPattern(\Codeception\Configuration::outputDir(), '/failedTests_\w+\.txt$/')
    ->into(\Codeception\Configuration::outputDir() . 'failedTests.txt') // absolute path with Filename
    ->run();

$result = $this
    ->taskSplitFailedTests(5)
    ->setReportPath(\Codeception\Configuration::outputDir() . 'failedTests.txt') // absoulute Path to Reportfile
    ->groupsTo(\Codeception\Configuration::outputDir() . 'group_')
    ->run();

// optionally check result data
if ($result->wasSuccessful()) {
    $filenames = $result['files'];
} 

$this->taskMergeXmlReports()
    ->from('tests/result/result1.xml')
    ->from('tests/result/result2.xml')
    ->into('tests/result/merged.xml')
    ->run();

$this->taskMergeHtmlReports()
    ->from('tests/result/result1.html')
    ->from('tests/result/result2.html')
    ->into('tests/result/merged.html')
    ->run();
 
$filter = new GroupFilter();
$filter
    ->groupIncluded('foo')
    ->groupIncluded('bar')
    ->groupExcluded('baz');

$this->taskSplitTestsByGroups(5)
   ->testsFrom('tests')
   ->groupsTo('tests/_data/paratest_')
   ->addFilter($filter)
   ->run();
 


declare(strict_types=1);

namespace ...;

use Codeception\Task\Filter\DefaultFilter;

class CustomFilter extends DefaultFilter {

}

\Codeception\Configuration::config('tests/codeception.yml');