bex / behat-step-time-logger
Extension for behat to help find slow scenario steps by logging the step times
Installs: 1 350 775
Dependents: 1
Suggesters: 0
Security: 0
Stars: 26
Watchers: 2
Forks: 9
Open Issues: 5
Requires
- php: >=5.5
- behat/behat: ^3.0.0
- symfony/filesystem: >=2.3 || ^3.0.0
Requires (Dev)
- behat/mink-selenium2-driver: ^1.3.0
- bex/behat-test-runner: dev-master
- jakoch/phantomjs-installer: ^1.9.8
- phpspec/phpspec: 2.4.0-alpha2
This package is auto-updated.
Last update: 2024-11-29 04:46:43 UTC
README
Behat-StepTimeLoggerExtension helps you find slow behat scenario steps by logging the step times.
Installation
Install by adding to your composer.json
:
composer require --dev bex/behat-step-time-logger
Configuration
Enable the extension in behat.yml
like this:
default: extensions: Bex\Behat\StepTimeLoggerExtension: ~
You can configure which output printer should be used:
default: extensions: Bex\Behat\StepTimeLoggerExtension: output: csv # possible values: console, csv. default value: console
You can even enable both output printer at once:
default: extensions: Bex\Behat\StepTimeLoggerExtension: output: [console, csv]
You can enable the logger to run every time even if you don't use the --log-step-times flag:
default: extensions: Bex\Behat\StepTimeLoggerExtension: enabled_always: true
You can configure the output directory of the csv printer as well:
ci: extensions: Bex\Behat\StepTimeLoggerExtension: output_directory: /your/path/for/the/csvfile # by default it will be saved to the /tmp/steptimelogger directory
Usage
When debugging a particular scenario, use the --log-step-times
flag at the cli:
bin/behat --log-step-times
Or use the enabled_always
config setting to run the logger every time. (See configuration section)
Example output
+------------------------+--------------+-----------------------------------------------------+ | Average execution Time | Called count | Total Cost | Step name | +------------------------+--------------+-----------------------------------------------------+ | 1.73161 | 2 | 3.46322 | I am on page "test-product.html" | | 0.30817 | 1 | 0.30817 | I should see "$99,999.00" as the price | | 0.05326 | 2 | 0.10652 | I should see "Add to Compare" | +------------------------+--------------+-----------------------------------------------------+
Step time log has been saved. Open at /tmp/steptimelogger/step-times-1447580698.csv