PHPackages                             bex/behat-screenshot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bex/behat-screenshot

AbandonedArchivedLibrary

bex/behat-screenshot
====================

Extension for behat to help debug failing scenarios

2.1.0(6y ago)925.3M↓20.7%16[9 issues](https://github.com/elvetemedve/behat-screenshot/issues)[3 PRs](https://github.com/elvetemedve/behat-screenshot/pulls)20MITPHPPHP &gt;=5.5

Since Nov 13Pushed 2y ago3 watchersCompare

[ Source](https://github.com/elvetemedve/behat-screenshot)[ Packagist](https://packagist.org/packages/bex/behat-screenshot)[ Docs](https://github.com/elvetemedve/behat-screenshot)[ RSS](/packages/bex-behat-screenshot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (23)Used By (20)

Behat-ScreenshotExtension
=========================

[](#behat-screenshotextension)

[![License](https://camo.githubusercontent.com/abe8e5beaefc5e2b8caa42f440f2c6fb19fa77f5ae120a2cb5c3d163668dd69b/68747470733a2f2f706f7365722e707567782e6f72672f6265782f62656861742d73637265656e73686f742f6c6963656e7365)](https://packagist.org/packages/bex/behat-screenshot)[![Latest Stable Version](https://camo.githubusercontent.com/a03f5f103ea9f2a64a53a15bd3017fba31ea2828f8fdf3a7047529bd5f94fdbe/68747470733a2f2f706f7365722e707567782e6f72672f6265782f62656861742d73637265656e73686f742f76657273696f6e)](https://packagist.org/packages/bex/behat-screenshot)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b581bdc636b4c6f28611eec6dc7db6307f3ee2440da70604a3d67ec50f7e5727/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656c766574656d656476652f62656861742d73637265656e73686f742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/elvetemedve/behat-screenshot/?branch=master)[![Build Status](https://camo.githubusercontent.com/104a3f820707a773a6a5b498ea9d582b285de78fc9c6dbc6b8e769304083fd09/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656c766574656d656476652f62656861742d73637265656e73686f742f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/elvetemedve/behat-screenshot/build-status/master)[![Build Status](https://camo.githubusercontent.com/0053e3ad39a4c5e44ee4cc83fb6506f81cc07bb69a1a3197c60c83a8326acabc/68747470733a2f2f7472617669732d63692e6f72672f656c766574656d656476652f62656861742d73637265656e73686f742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/elvetemedve/behat-screenshot)

Behat-ScreenshotExtension helps you debug Behat scenarios by taking screenshot of the failing steps.

By default the extension takes the screenshot and save it to the preconfigured directory (by default it will save the image to the default temporary system directory).

Also the extension allows you to specify an image driver which can upload the image to a host, in this case you will see the image url in the terminal right after the failing step. See available image drivers [below](#available-image-drivers).

You can also create your own image driver easily, for more information see [this section](#how-to-create-your-own-image-driver).

Installation
------------

[](#installation)

Install by adding to your `composer.json`:

```
composer require --dev bex/behat-screenshot
```

Configuration
-------------

[](#configuration)

Enable the extension in `behat.yml` like this:

```
default:
  extensions:
    Bex\Behat\ScreenshotExtension: ~
```

You can configure the screenshot directory like this:

```
default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      image_drivers:
        local:
          screenshot_directory: /your/desired/path/for/screenshots
          clear_screenshot_directory: true  # Enable removing all images before each test run. It is false by default.
```

If you are using another image driver you can enable it like this:

```
default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      active_image_drivers: customdriver
      image_drivers: # this node and the driver subnodes are optional, if you remove it then the driver's default values will be used
        customdriver:
          #... custom driver config goes here ...
```

You can even enable more than one image driver at once:

```
default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      active_image_drivers: [local, customdriver]
      image_drivers:
        local:
          #... local driver config goes here ...
        customdriver:
          #... custom driver config goes here ...
```

You can make a combined screenshot including previous steps:

```
default:
  extensions:
    Bex\Behat\ScreenshotExtension:
      screenshot_taking_mode: failed_scenarios
        # Available modes:
        #  - failed_steps: Image contains only the screenshot of the failed step. [Default]
        #  - failed_scenarios: Image contains screenshots of all steps in a failed scenario.
        #  - all_scenarios: Each scenario has a combined image created, regardless of failing or passing.
```

You can disable the extension by removing from the behat.yml or you can disable it for a profile by using the `enabled` parameter, e.g.:

```
ci:
  extensions:
    Bex\Behat\ScreenshotExtension:
      enabled: false
```

Usage
-----

[](#usage)

When you run behat and a step fails then the extension will automatically take the screenshot and you will see the filepath or the image URL of the screenshot (based on the configured image driver). So you will see something like this:

```
  Scenario:                           # features/feature.feature:2
    Given I have a step               # FeatureContext::passingStep()
    When I have a failing step        # FeatureContext::failingStep()
      Error (Exception)
Screenshot has been taken. Open image at /tmp/behat-screenshot/i_have_a_failing_step.png
    Then I should have a skipped step # FeatureContext::skippedStep()
```

Available Image Drivers
-----------------------

[](#available-image-drivers)

- [bex/behat-screenshot-image-driver-uploadpie](https://packagist.org/packages/bex/behat-screenshot-image-driver-uploadpie)
- [bex/behat-screenshot-image-driver-img42](https://packagist.org/packages/bex/behat-screenshot-image-driver-img42)
- [bex/behat-screenshot-image-driver-unsee](https://packagist.org/packages/bex/behat-screenshot-image-driver-unsee)

How to create your own image driver
-----------------------------------

[](#how-to-create-your-own-image-driver)

1. Implement the `Bex\Behat\ScreenshotExtension\Driver\ImageDriverInterface`
2. Put your class under the `Bex\Behat\ScreenshotExtension\Driver` namespace

That's it!

See example here:

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity56

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 54.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~190 days

Total

21

Last Release

2232d ago

Major Versions

1.2.9 → 2.0.02020-04-07

PHP version history (2 changes)1.0.0PHP &gt;=5.4

2.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/6451ac5fdc814bfa3aec1b3cf746fdb3ccec68ccbbe3a6f30b3b6c9266b0cb79?d=identicon)[tkotosz](/maintainers/tkotosz)

![](https://www.gravatar.com/avatar/c11efe0a5d5bb599838119d46f0f25e031f16d20ea4a04ca2384c645535049f0?d=identicon)[elvetemedve](/maintainers/elvetemedve)

---

Top Contributors

[![elvetemedve](https://avatars.githubusercontent.com/u/596431?v=4)](https://github.com/elvetemedve "elvetemedve (19 commits)")[![cyberwolf](https://avatars.githubusercontent.com/u/95102?v=4)](https://github.com/cyberwolf "cyberwolf (5 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (2 commits)")[![marcortola](https://avatars.githubusercontent.com/u/15958009?v=4)](https://github.com/marcortola "marcortola (1 commits)")[![mnocon](https://avatars.githubusercontent.com/u/10993858?v=4)](https://github.com/mnocon "mnocon (1 commits)")[![pfrenssen](https://avatars.githubusercontent.com/u/442924?v=4)](https://github.com/pfrenssen "pfrenssen (1 commits)")[![pgrimaud](https://avatars.githubusercontent.com/u/1866496?v=4)](https://github.com/pgrimaud "pgrimaud (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (1 commits)")[![tkotosz](https://avatars.githubusercontent.com/u/4903365?v=4)](https://github.com/tkotosz "tkotosz (1 commits)")[![hkorik](https://avatars.githubusercontent.com/u/4753855?v=4)](https://github.com/hkorik "hkorik (1 commits)")[![marcelovani](https://avatars.githubusercontent.com/u/2162363?v=4)](https://github.com/marcelovani "marcelovani (1 commits)")

---

Tags

BDDTDDBehatbehat-screenshot

### Embed Badge

![Health badge](/badges/bex-behat-screenshot/health.svg)

```
[![Health](https://phpackages.com/badges/bex-behat-screenshot/health.svg)](https://phpackages.com/packages/bex-behat-screenshot)
```

###  Alternatives

[ezsystems/behat-screenshot-image-driver-cloudinary

Cloudinary image driver for bex/behat-screenshot behat extension

28992.5k16](/packages/ezsystems-behat-screenshot-image-driver-cloudinary)[polishsymfonycommunity/symfony-mocker-container

Provides base Symfony dependency injection container enabling service mocking.

1468.0M237](/packages/polishsymfonycommunity-symfony-mocker-container)[bex/behat-step-time-logger

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

261.5M1](/packages/bex-behat-step-time-logger)[bex/behat-extension-driver-locator

Driver locator tool for behat extensions

385.2M4](/packages/bex-behat-extension-driver-locator)[ciaranmcnulty/behat-stepthroughextension

Extension for behat to help debug failing scenarios

601.6M5](/packages/ciaranmcnulty-behat-stepthroughextension)[polishsymfonycommunity/symfony2-mocker-extension

Behat extension for mocking services defined in the Symfony2 dependency injection container.

26253.1k4](/packages/polishsymfonycommunity-symfony2-mocker-extension)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
