PHPackages                             fesor/behat-stepler - 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. fesor/behat-stepler

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

fesor/behat-stepler
===================

Simple CLI tool to run specific behat step

v1.1.2(10y ago)416.0k1[1 issues](https://github.com/fesor/behat-stepler/issues)MITPHPPHP &gt;=5.4.0

Since Jun 20Pushed 9y ago2 watchersCompare

[ Source](https://github.com/fesor/behat-stepler)[ Packagist](https://packagist.org/packages/fesor/behat-stepler)[ RSS](/packages/fesor-behat-stepler/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Behat Stepler
=============

[](#behat-stepler)

Simple behat extension which lets you run just specific gherkin step form CLI.

Why?
----

[](#why)

Gherkin gives us unified way to describe business requirements, but what if we want E2E tests? Let's pretend that we have project with several components: iOS application, Android application, single-page application frontend and API on backend. For all listed components there is a great tools: [cucumber.js](https://github.com/cucumber/cucumber-js), [calabash](http://calaba.sh/), [behat](http://behat.org). But if you'll start implement E2E tests you'll face a little problem: most of scenarios have some preconditions, which should be set on backend.

So... what does this extension? It just provide you a way to execute specific step anytime you want. For example, you can implement steps required by preconditions in `behat`, and then just call this steps from your `cucumber.js` suites for example.

Usage
-----

[](#usage)

You can install this extension via composer:

```
$ composer require --dev fesor/behat-stepler

```

Then you'll need to add extension into your `behat.yml`:

```
default:
    suites:
        default:
            contexts:
              - FeatureContext
    extensions:
        Fesor\Stepler:

```

That's it. Now you can call just single step:

```
$ behat --run-steps "Alice have user account:
| email    | alice@example.com    |
| password | alice_password       |"

```

### Step execution results

[](#step-execution-results)

Sometime useful to get results of executed step. Given you have step definition, which creates new user. Often you need to get ID of created user (for interaction with API for example). This step definition would looks something like this:

```
/**
 * @Given :name have account
 */
public function createUser($name)
{
    $user = $this->fakeUserFactory($name);
    $this->userRepository->add($user);

    return $user->getDTO();
}
```

Then, if we run this step with `--return-step-results` option:

```
$ behat --run-steps "Bob have account" --return-step-result

```

We will get something like this:

```
{"id": 1, "name": "Bob"}

```

Data will be serialized with `json_encode`, so you should return some kind of DTO, which can be easly serialized into JSON (arrays, simple objects of objects which implements `JsonSerializable` interface).

### Hooks

[](#hooks)

Please not that only `BeforeStep` and `AfterStep` hooks are available. If you want to clear your database for example, the workaround for this will be specific step that will purge all test data.

Contribution
------------

[](#contribution)

Feel free to contribute! Any help or ideas will be useful!

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~102 days

Total

4

Last Release

3697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/736e9d33560d4c01cd2b9dfb70bbcbd8219d4b61967f98ffa09d35101ceeaac8?d=identicon)[fesor](/maintainers/fesor)

---

Top Contributors

[![fesor](https://avatars.githubusercontent.com/u/172247?v=4)](https://github.com/fesor "fesor (16 commits)")[![mkusher](https://avatars.githubusercontent.com/u/523021?v=4)](https://github.com/mkusher "mkusher (3 commits)")[![YuraLukashik](https://avatars.githubusercontent.com/u/4070636?v=4)](https://github.com/YuraLukashik "YuraLukashik (1 commits)")

### Embed Badge

![Health badge](/badges/fesor-behat-stepler/health.svg)

```
[![Health](https://phpackages.com/badges/fesor-behat-stepler/health.svg)](https://phpackages.com/packages/fesor-behat-stepler)
```

###  Alternatives

[drupal/drupal-extension

Drupal extension for Behat

21215.5M166](/packages/drupal-drupal-extension)[friends-of-behat/symfony-extension

Integrates Behat with Symfony.

48024.5M628](/packages/friends-of-behat-symfony-extension)[friends-of-behat/variadic-extension

Variadic support for behat context arguments

2276.3M485](/packages/friends-of-behat-variadic-extension)[wp-cli/wp-cli-tests

WP-CLI testing framework

423.0M129](/packages/wp-cli-wp-cli-tests)[friends-of-behat/mink-extension

Mink extension for Behat

14035.9M549](/packages/friends-of-behat-mink-extension)[imbo/behat-api-extension

API extension for Behat

1092.6M9](/packages/imbo-behat-api-extension)

PHPackages © 2026

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