To monitor the test execution process, Codeception provides a powerful Extensions mechanism. You can define your own extension, which gets the test time after its execution and saves this value where you need it.
For example, I will give an extension code that displays in the console the path of the executed test script and the time of its execution.
tests / _support / TimingExtension.php :
<?php class TimingExtension extends \Codeception\Extension { public static $events = array( 'test.after' => 'afterTest', ); public function afterTest(\Codeception\Event\TestEvent $e) { echo(sprintf( "%s: %s\n", $e->getTest()->getMetadata()->getFilename(), $e->getTime() )); } }
In order for this extension to work, you need to connect it in the extensions section of the main Codeception configuration file ( codeception.yml ).
tests / codeception.yml :
# ... extensions: enabled: - TimingExtension # Прочие расширения, которые уже были здесь - Codeception\Extension\RunFailed # ...
More information about connecting your own extensions can be found in the documentation .