PHPackages                             creativesoftworks/behat-wiremock-context-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. [Testing &amp; Quality](/categories/testing)
4. /
5. creativesoftworks/behat-wiremock-context-extension

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

creativesoftworks/behat-wiremock-context-extension
==================================================

A Behat Extension that makes use of Wiremock as a test double for API calls

v1.0.1(11y ago)08.7k1[1 issues](https://github.com/creativesoftworks/BehatWiremockContextExtension/issues)MITPHPPHP &gt;=5.3.0

Since Jun 19Pushed 10y ago2 watchersCompare

[ Source](https://github.com/creativesoftworks/BehatWiremockContextExtension)[ Packagist](https://packagist.org/packages/creativesoftworks/behat-wiremock-context-extension)[ Docs](https://github.com/creativesoftworks/BehatWiremockContextExtension)[ RSS](/packages/creativesoftworks-behat-wiremock-context-extension/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

BehatWiremockContextExtension
=============================

[](#behatwiremockcontextextension)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7388ae335edca9c2b5f4c94ff3af816192008f170eb2495a6ec8a57a9e24bb07/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6372656174697665736f6674776f726b732f4265686174576972656d6f636b436f6e74657874457874656e73696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/creativesoftworks/BehatWiremockContextExtension/?branch=master)[![Build Status](https://camo.githubusercontent.com/f5cc1c9fbdaa0a39b0397b98b62e555d0a41053b4d07d0445670dfece07e48b3/68747470733a2f2f7472617669732d63692e6f72672f6372656174697665736f6674776f726b732f4265686174576972656d6f636b436f6e74657874457874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/creativesoftworks/BehatWiremockContextExtension)

A Behat Extension that makes use of [Wiremock](http://wiremock.org) as a test double for API calls.

Versions and compatibility
--------------------------

[](#versions-and-compatibility)

- Versions 1.x are compatible with behat 2.4+
- No compatibility for behat 3 (yet...)
- No compatibility for Windows

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

[](#installation)

Via composer:

```
"require-dev": {
    "creativesoftworks/behat-wiremock-context-extension": "1.*"
}
```

Your FeatureContext class must implement the [CreativeSoftworks\\BehatWiremockContextExtension\\WiremockContextAware](https://github.com/creativesoftworks/BehatWiremockContextExtension/blob/master/src/CreativeSoftworks/BehatWiremockContextExtension/WiremockContextAware.php) interface, here's an example:

```
class FeatureContext implements WiremockContextAware
{
    /**
     * @return \CreativeSoftworks\BehatWiremockContextExtension\WiremockContext
     */
    public function getWiremockContext()
    {
        return $this->getSubcontext('WiremockContext');
    }

    /**
     * @param \CreativeSoftworks\BehatWiremockContextExtension\WiremockContext $wiremockContext
     */
    public function setWiremockContext(WiremockContext $wiremockContext)
    {
        $this->useContext('WiremockContext', $wiremockContext);
    }
}
```

Configuration
-------------

[](#configuration)

Configuration options, in your behat.yml:

```
your_profile_name:
    extensions:
        CreativeSoftworks\BehatWiremockContextExtension\Extension:
            wiremock_base_url: 'http://localhost:8080'
            wiremock_mappings_path: 'app/Resources/wiremock/mappings'
```

The extension will reset the wiremock mappings before each scenario execution, so all mappings under wiremock\_mappings\_path will get loaded with no guaranteed order. Frequently you would want to guarantee that certain mappings will become defaults in wiremock (usually successful responses instead of failed ones). In order for that to happen you can define an array of mappings to be loaded, relative to wiremock\_mappings\_path, like in this example:

```
            default_mappings:
                - { service: service-name, mapping: mapping-file.json }
                - { service: service-name/and-subdirectory, mapping: another-mapping-file.json }
```

Usage Example:
--------------

[](#usage-example)

The WiremockContext provides a step definition to submit mappings to wiremock. Here's an example of a scenario using it:

```
Scenario:
    Given the following services exist:
        | service  | mapping         |
        | greeting | helloWorld.json |
    When I go to the "Hello World" page
    Then I should see "Hello World!"

```

The first step in the scenario POSTs the mapping information in the file %wiremock\_mappings\_path%/greeting/helloWorld.json to the Wiremock server. Check [this](http://wiremock.org/stubbing.html#stubbing) for more information about wiremock stubbing using JSON mapping files.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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 ~20 days

Total

3

Last Release

4357d ago

Major Versions

v0.1 → v1.02014-07-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce900c614052702f1762a95fb9d342f5c5403634c5cefe2d1f4255585ba3b4fc?d=identicon)[ricoli](/maintainers/ricoli)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/creativesoftworks-behat-wiremock-context-extension/health.svg)

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

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

22215.7M173](/packages/drupal-drupal-extension)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.1M142](/packages/wp-cli-wp-cli-tests)[friends-of-behat/symfony-extension

Integrates Behat with Symfony.

48125.0M664](/packages/friends-of-behat-symfony-extension)[friends-of-behat/variadic-extension

Variadic support for behat context arguments

2276.4M506](/packages/friends-of-behat-variadic-extension)[drevops/behat-steps

Collection of steps for Behat

27431.3k4](/packages/drevops-behat-steps)[friends-of-behat/mink-extension

Mink extension for Behat

14036.7M588](/packages/friends-of-behat-mink-extension)

PHPackages © 2026

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