bex/behat-step-time-logger

Extension for behat to help find slow scenario steps by logging the step times

2.0.0 2018-10-12 07:06 UTC

This package is auto-updated.

Last update: 2024-11-29 04:46:43 UTC


README

License Latest Stable Version Scrutinizer Code Quality Build Status Build Status

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