chartinger / around-hook-extension
Around hook support for behat v3
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Type:behat-extension
Requires
- php: >=5.3.2
- behat/behat: ~3.0.0@dev
Requires (Dev)
- phpunit/phpunit: ~3.7.28
- symfony/process: ~2.1
This package is not auto-updated.
Last update: 2020-01-20 03:42:29 UTC
README
Around hook support for Behat 3
This project aims to mimic the Cucumber around feature in Behat 3.x
Example
Given you want to run the same Scenario with multiple screen resolutions it could look like this:
... /** * @AroundScenario */ public function runWithMultipleWindowSizes(AroundScenarioScope $scope) { $this->width = 1920; $scope->callBlock(" [1920]"); $this->width = 800; $scope->callBlock(" [800]"); } /** * @BeforeScenario */ public function resizeWindow() { $this->getSession()->resizeWindow($this->width, $this->height); } ...
Where in the optional parameter of callBlock()
you can define a suffix to the scenario title
Example output of Behat could be:
... Scenario: Simpler Test [1920] Given I am on "http://somehomepage" When I do something Then i should see "Hello World" Scenario: Simpler Test [800] Given I am on "http://somehomepage" When I do something Then i should see "Hello World" ...
Installation
In your composer.json
add
{ "require": { ... "chartinger/around-hook-extension": "*@dev" } }
and update your dependencies
Usage
To activate this extension add this to your behat.yml
default: extensions: chartinger\Behat\AroundHookExtension\AroundHookExtension: ~
You can now use the @AroundScenario
annotation in your Behat Context
use chartinger\Behat\AroundHookExtension\AroundScenarioScope; ... /** * @AroundScenario */ public function aroundScenario(AroundScenarioScope $scope) { $scope->callBlock(); }