An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Behat Table Comparison

[![Packagist](https://img.shields.io/packagist/v/traviscarden/behat-table-comparison.svg)](https://packagist.org/packages/traviscarden/behat-table-comparison)
[![Build Status](https://travis-ci.org/TravisCarden/behat-table-comparison.svg?branch=develop)](https://travis-ci.org/TravisCarden/behat-table-comparison)
[![Coverage Status](https://coveralls.io/repos/github/TravisCarden/behat-table-comparison/badge.svg?branch=master)](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:

![Example Output](resources/example-output.gif)

## 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).