PHPackages                             genesis/behat-api-spec - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. genesis/behat-api-spec

ActiveLibrary[Testing &amp; Quality](/categories/testing)

genesis/behat-api-spec
======================

Maintain your APIs with ease using snapshot testing.

1.7.0(5y ago)2334[15 issues](https://github.com/forceedge01/behat-api-spec/issues)[2 PRs](https://github.com/forceedge01/behat-api-spec/pulls)MITPHPPHP ~7.2

Since Mar 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/forceedge01/behat-api-spec)[ Packagist](https://packagist.org/packages/genesis/behat-api-spec)[ RSS](/packages/genesis-behat-api-spec/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (7)Versions (18)Used By (0)

API Spec [![Build Status](https://camo.githubusercontent.com/50de3044f4ecb3e4d69710ae7724959e39b344cb22ad699840eaf5b987d5b401/68747470733a2f2f7472617669732d63692e636f6d2f666f7263656564676530312f62656861742d6170692d737065632e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/forceedge01/behat-api-spec) [![License](https://camo.githubusercontent.com/94f88cb7d1aea1e21d707654cdc18e5a9590101bd2e18d59b08c3ad0a3a5ebfd/68747470733a2f2f706f7365722e707567782e6f72672f67656e657369732f62656861742d6170692d737065632f6c6963656e7365)](https://packagist.org/packages/genesis/behat-api-spec)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#api-spec--)

Got API's but no time to put automated tests around it? Already have automated tests but are hard to maintain? Here is an effective automated solution that will prevent regression and maintain itself on demand.

Release notes
-------------

[](#release-notes)

Major:

- Snapshot testing.

Minor:

- Using 'snapshot pattern' step defintion produces a regex snapshot.
- Check multiple json keys in response with one step definition.

Patch:

- Running single scenario does not affect other scenario snapshots.

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

[](#installation)

```
composer require genesis/behat-api-spec
```

behat.yml file

```
default:
  suites:
    default:
      contexts:
        - Genesis\BehatApiSpec\Context\ApiSpecContext
  extensions:
    Genesis\BehatApiSpec\Extension:
      baseUrl:
      specMappings:
        endpoint:
```

Basic overview
--------------

[](#basic-overview)

You can generate an endpoint file using the --endpoint-generate option. Simply run the following command for an interactive shell:

```
./vendor/bin/behat --endpoint-generate
```

Manually create an endpoint file

```
