PHPackages                             seretos/behat-logger-extension - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. seretos/behat-logger-extension

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

seretos/behat-logger-extension
==============================

log the behat execution into json result

v3.0.4(7y ago)01.9k1MITPHPPHP ^7.1

Since Aug 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Seretos/BehatLoggerExtension)[ Packagist](https://packagist.org/packages/seretos/behat-logger-extension)[ Docs](https://github.com/Seretos/BehatLoggerExtension)[ RSS](/packages/seretos-behat-logger-extension/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (9)Versions (56)Used By (0)

BehatLoggerExtension
====================

[](#behatloggerextension)

this package provides an extension for behat to log the test results in an json-file. this package also provide commands to validate and merge this json files.

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

[](#installation)

> INFORMATION: if you want to use the behat logger extension for your project, please read the "PHP Integration" section! The installation section installs only the cli-commands as standalone application

For users is now a docker-image available. For developers see PHP Integration

Migration from 1.x to 2.x
-------------------------

[](#migration-from-1x-to-2x)

since the major release 2, the identification of tests for synchronization has changed. In version 1 the title of the scenario was used for synchronization. in this release, an id will used, given by an behat-tag. every test requires an unique identifier tag. for example "@testrail-case-1,@testrail-case-2, e.t.c." update your dependency to the last 1.x version and add the following properties to your .testrail.yml

```
api:
    ...
    identifier_tag_field: yourNewIdentifierField
```

execute the testrail:push:cases command to add all the ids to your cases in testrail. Now you can update to 2.x (but some .testrail.yml properties has changed!!!)

### docker image

[](#docker-image)

```
docker run -v /path/to/project/:/behat/ seretos/behat-logger-cli behat-logger-cli list
```

add the docker-container to your docker-compose.yml

```
version: '3.7'

services:
  features-push:
    image: seretos/behat-logger-cli
    command: push
    volumes:
      - ./:/behat/
    environment:
      TESTRAIL_SERVER: http://testrail:80
      TESTRAIL_USER: yourTestrailLogin
      TESTRAIL_PASSWORD: yourTestrailPassword
      TESTRAIL_PROJECT: yourTestrailProject
      TESTRAIL_SUITE: yourTestrailSuite

  features-validate:
    image: seretos/behat-logger-cli
    command: validate
    volumes:
      - ./:/behat/
```

PHP Integration
---------------

[](#php-integration)

add the package to your project as below

```
composer require seretos/behat-logger-extension --dev
vendor/bin/behat-logger-cli --help
```

activate the logger in your behat.yml:

```
default:
    formatters:
        logger: ~
    extensions:
        seretos\BehatLoggerExtension\BehatLoggerExtension:
            output_path: '%paths.base%/build/behat'
```

> OPTIONAL: if you use an symfony application, you can add this extension (seretos\\BehatLoggerExtension\\BehatLoggerExtensionBundle) to your Symfony Kernel and integrate the commands in your cli

Command line usage
------------------

[](#command-line-usage)

combine different result jsons into one file and one suite:

```
behat-logger-cli combine:logs [suite-name] --output=/output/path/ --regex=results/firefox*
```

> if different jsons contain a testresult for one test with the same environment, this command throws an exception

convert all found feature-files to one json-file without results:

```
behat-logger-cli feature:to:log [suite-name] --output=/output/path/ --regex=features/
```

check that all scenarios in the log file has an unique title:

> This command is deprecated please use validate:scenario:id in future!

```
behat-logger-cli validate:scenario:title [log-file.json]
```

check that all schenarios in the log file has an unique id tag:

```
behat-logger-cli validate:scenario:id [log-file.json] --identifier_tag_regex="/^testrail-case-([0-9]*)$/"
```

check that all tests are executed in the given environments:

```
# check that all browserless tests are executed
behat-logger-cli validate:execution actual.json expected.json --tags=~javascript --environments=unknown
# check that all browser tests are executed in firefox and chrome
behat-logger-cli validate:execution actual.json expected.json --tags=javascript --environments=firefox --environments=chrome
```

send a json-result to testrail and create sections and cases

```
behat-logger-cli testrail:push:cases testRailSuiteName actual.json
```

send a json-result to testrail and create environment configurations:

```
behat-logger-cli testrail:push:configs actual.json
```

send a json-result to testrail and create results

```
behat-logger-cli testrail:push:results testRailSuiteName actual.json testResultName --milestone=v2.8.0
```

the commands testrail:push:cases and testrail:push:results requires an .testrail.yml in the current work directory with the following informations:

```
api:
  server: https://yourTestrail.testrail.io/
  user: yourUser@mail.de
  password: yourPassword
  project: youtProject
  template: Test Case (Steps)
  type: Automated
  title_field: custom_preconds
  group_field: custom_automation_type
  identifier_field: custom_identifier
  identifier_regex: /^testrail-case-([0-9]*)$/

# set field an priorities on specific tags
fields:
  /^.*$/:
    custom_automation_type: Behat

priorities:
  /^priority_low$/: Low
```

log format
----------

[](#log-format)

first of all, the json file contains the behat suite. if the log-writer can not detect the suite name, they use a suite named "default"

```
{
  "suites": [
    {
      "name": "default",
      "features": {
        ...
      }
    }
  ]
}
```

the suite contains a list of features:

```
"features": {
  "features\/featurefile.feature": {
    "title": "feature title",
    "filename": "features\/featurefile.feature",
    "description": null,
    "language": "en",
    "scenarios": {
      ...
    }
  },
  ...
}
```

and a feature contains scenarios with steps and results

```
"scenarios": {
  "scenariotitle": {
    "title": "scenariotitle",
    "tags": ["behattag1","behattag2"],
    "steps": [
      {
        "line": 0,
        "text": "the user 'test' exists",
        "keyword": "Given",
        "arguments": []
      },
      {
        "line": 1,
        "text": "i logged in as 'test'",
        "keyword": "And",
        "arguments": []
      }
    ],
    "results": [
      ...
    ]
  },
  ...
}
```

and last but not least, contains the features results. the environment property is the browser name. on guette the environment name is setted to "unknown"

```
"results": [
"firefox": {
  "environment": "firefox",
  "duration": "1.00",
  "message": null,
  "stepResults": [
    {
      "line": 0,
      "passed": true,
      "screenshot": null,
      "message": null
    },
    {
      "line": 1,
      "passed": true,
      "screenshot": null,
      "message": null
    }
  ]
  }
]
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

52

Last Release

2631d ago

Major Versions

v0.3.1 → v1.0.02018-08-31

v1.6.0 → v2.0.02019-02-01

v2.1.1 → v3.0.02019-02-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/1956f0019585e067a8c17676304b6f9442aa9c495c81d4294f5805940ed3fd12?d=identicon)[Seretos](/maintainers/Seretos)

---

Top Contributors

[![Seretos](https://avatars.githubusercontent.com/u/18718900?v=4)](https://github.com/Seretos "Seretos (102 commits)")

---

Tags

loggerBehatextension

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/seretos-behat-logger-extension/health.svg)

```
[![Health](https://phpackages.com/badges/seretos-behat-logger-extension/health.svg)](https://phpackages.com/packages/seretos-behat-logger-extension)
```

###  Alternatives

[friends-of-behat/mink-debug-extension

Debug extension for Behat

2075.3M286](/packages/friends-of-behat-mink-debug-extension)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8674.9k](/packages/illuminated-console-logger)[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3456.3k](/packages/lav45-yii2-activity-logger)[soulcodex/laravel-behat

Laravel Extension for easy integration with Behat

1760.8k](/packages/soulcodex-laravel-behat)[opengento/module-webapi-logger

This module allows you to analyze all the webapi rest done call toward your Magento.

1014.9k](/packages/opengento-module-webapi-logger)

PHPackages © 2026

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