RunFailed
extends Extension
in package
Saves failed tests into tests/_output/failed in order to rerun failed tests.
To rerun failed tests just run the failed
group:
php codecept run -g failed
To change failed group name add:
--override "extensions: config: Codeception\Extension\RunFailed: fail-group: another_group1"
Remember: if you run tests and they generated custom-named fail group, to run this group, you should add override too
Starting from Codeception 2.1 this extension is enabled by default.
extensions:
enabled: [Codeception\Extension\RunFailed]
On each execution failed tests are logged and saved into tests/_output/failed
file.
Table of Contents
Properties
- $events : mixed
- $config : mixed
- $globalConfig : mixed
- $group : string
- $options : mixed
- $output : mixed
- $modules : mixed
Methods
- __construct() : mixed
- _initialize() : mixed
- You can do all preparations here. No need to override constructor.
- _reconfigure() : mixed
- Pass config variables that should be injected into global config.
- getCurrentModuleNames() : mixed
- getDataDir() : mixed
- getGlobalConfig() : mixed
- getLogDir() : mixed
- getModule() : mixed
- getRootDir() : mixed
- getSubscribedEvents() : array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>>
- Returns an array of event names this subscriber wants to listen to.
- getTestsDir() : mixed
- hasModule() : mixed
- receiveModuleContainer() : mixed
- saveFailed() : mixed
- localizePath() : mixed
- write() : mixed
- writeln() : mixed
Properties
$events
public
static mixed
$events
= [\Codeception\Events::RESULT_PRINT_AFTER => 'saveFailed']
$config
protected
mixed
$config
= []
$globalConfig
protected
mixed
$globalConfig
$group
protected
string
$group
= 'failed'
filename/groupname for failed tests
$options
protected
mixed
$options
$output
protected
mixed
$output
$modules
private
mixed
$modules
= []
Methods
__construct()
public
__construct(mixed $config, mixed $options) : mixed
Parameters
- $config : mixed
- $options : mixed
_initialize()
You can do all preparations here. No need to override constructor.
public
_initialize() : mixed
Also you can skip calling _reconfigure
if you don't need to.
_reconfigure()
Pass config variables that should be injected into global config.
public
_reconfigure([array<string|int, mixed> $config = [] ]) : mixed
Parameters
- $config : array<string|int, mixed> = []
getCurrentModuleNames()
public
getCurrentModuleNames() : mixed
getDataDir()
public
getDataDir() : mixed
getGlobalConfig()
public
getGlobalConfig() : mixed
getLogDir()
public
getLogDir() : mixed
getModule()
public
getModule(mixed $name) : mixed
Parameters
- $name : mixed
getRootDir()
public
getRootDir() : mixed
getSubscribedEvents()
Returns an array of event names this subscriber wants to listen to.
public
static getSubscribedEvents() : array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>>
The array keys are event names and the value can be:
- The method name to call (priority defaults to 0)
- An array composed of the method name to call and the priority
- An array of arrays composed of the method names to call and respective priorities, or 0 if unset
For instance:
- ['eventName' => 'methodName']
- ['eventName' => ['methodName', $priority]]
- ['eventName' => [['methodName1', $priority], ['methodName2']]]
The code must not depend on runtime state as it will only be called at compile time. All logic depending on runtime state must be put into the individual methods handling the events.
Return values
array<string, string|array{0: string, 1: int}|array<int, array{0: string, 1?: int}>>getTestsDir()
public
getTestsDir() : mixed
hasModule()
public
hasModule(mixed $name) : mixed
Parameters
- $name : mixed
receiveModuleContainer()
public
receiveModuleContainer(SuiteEvent $e) : mixed
Parameters
- $e : SuiteEvent
saveFailed()
public
saveFailed(PrintResultEvent $e) : mixed
Parameters
- $e : PrintResultEvent
localizePath()
protected
localizePath(mixed $path) : mixed
Parameters
- $path : mixed
write()
protected
write(mixed $message) : mixed
Parameters
- $message : mixed
writeln()
protected
writeln(mixed $message) : mixed
Parameters
- $message : mixed