https://github.com/traviscarden/behat-table-comparison
Provides an equality assertion for Behat TableNodes.
https://github.com/traviscarden/behat-table-comparison
behat gherkin
Last synced: about 1 year ago
JSON representation
Provides an equality assertion for Behat TableNodes.
- Host: GitHub
- URL: https://github.com/traviscarden/behat-table-comparison
- Owner: TravisCarden
- License: mit
- Created: 2017-01-25T16:14:36.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2022-06-23T14:48:14.000Z (about 4 years ago)
- Last Synced: 2025-05-08T00:04:05.740Z (about 1 year ago)
- Topics: behat, gherkin
- Language: PHP
- Homepage: https://packagist.org/packages/traviscarden/behat-table-comparison
- Size: 278 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Behat Table Comparison
[](https://packagist.org/packages/traviscarden/behat-table-comparison)
[](https://travis-ci.org/TravisCarden/behat-table-comparison)
[](https://coveralls.io/github/TravisCarden/behat-table-comparison?branch=master)
The Behat Table Comparison library provides an equality assertion for comparing Behat `TableNode` tables.
## Installation & Usage
Install the library via [Composer](https://getcomposer.org/):
```bash
composer require --dev traviscarden/behat-table-comparison
```
Then use the [`TableEqualityAssertion`](src/BehatTableComparison/TableEqualityAssertion.php) class in your [`FeatureContext` class](http://docs.behat.org/en/v2.5/guides/4.context.html):
```php
expectHeader(['name', 'race'])
->ignoreRowOrder()
->setMissingRowsLabel('Missing characters')
->setUnexpectedRowsLabel('Unexpected characters')
->assert();
}
}
```
Output is like the following:

## Examples
See [`features/bootstrap/FeatureContext.php`](features/bootstrap/FeatureContext.php) and [`features/examples.feature`](features/examples.feature) for more examples.
## Limitations & Known Issues
Some inequality detection currently works but does not yet display a helpful error message, because it has not been decided what it should show. Please help me [specify error messages for complex differences](https://github.com/TravisCarden/behat-table-comparison/issues/1).
## Contribution
All contributions are welcome according to [normal open source practice](https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution).