Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/br0ken-/behat-debug-extension
Debug Behat scenarios
https://github.com/br0ken-/behat-debug-extension
bdd behat behat-extension tdd testing
Last synced: 17 days ago
JSON representation
Debug Behat scenarios
- Host: GitHub
- URL: https://github.com/br0ken-/behat-debug-extension
- Owner: BR0kEN-
- License: mit
- Created: 2016-05-01T12:28:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-05-10T13:09:35.000Z (over 8 years ago)
- Last Synced: 2024-11-17T20:07:15.080Z (about 1 month ago)
- Topics: bdd, behat, behat-extension, tdd, testing
- Language: PHP
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Behat Debug Extension
Print any information you'd like to a command line during the test suite execution.
[![Build Status](https://img.shields.io/travis/BR0kEN-/behat-debug-extension/master.svg?style=flat)](https://travis-ci.org/BR0kEN-/behat-debug-extension)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/BR0kEN-/behat-debug-extension.svg?style=flat)](https://scrutinizer-ci.com/g/BR0kEN-/behat-debug-extension/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/BR0kEN-/behat-debug-extension.svg?style=flat)](https://scrutinizer-ci.com/g/BR0kEN-/behat-debug-extension)
[![Total Downloads](https://poser.pugx.org/behat/debug-extension/downloads)](https://packagist.org/packages/behat/debug-extension)
[![Latest Stable Version](https://poser.pugx.org/behat/debug-extension/v/stable)](https://packagist.org/packages/behat/debug-extension)
[![License](https://poser.pugx.org/behat/debug-extension/license)](https://packagist.org/packages/behat/debug-extension)## Usage
Add `@debug` tag to your feature definition:
```gherkin
@debug
Feature: TestScenario: Test
# ...
```Add extension to your configuration file:
```yml
default:
extensions:
Behat\DebugExtension: ~
```Extend your object with a trait:
```php
use Behat\DebugExtension\Debugger;class Example
{
use Debugger;
}
```Use the `debug` method wherever you like:
```php
public function method()
{
// ...
self::debug([
'Function arguments: %s',
'Second line',
], [
var_export(func_get_args(), true),
]);
// ...
}
```As you can see the `debug` method processed by `sprintf()` function, so second argument for a method is an array of placeholders.
### Messages
Also, with this extension, you able to print styled messages to a command line.
```php
new \Behat\DebugExtension\Message('comment', 2, [
'This is a first line of a message that will be printed to a command line.',
'Read documentation for this class to know how to use it.',
]);
```### Programmatic usage
```shell
export BEHAT_DEBUG=true
```This environment variable tells that messages should be printed in any way.