How to use helper contexts in Behat 3.0

in behend 2.5, if I want to share my definitions of steps, I need to create several clans

class FeatureContext extends MinkContext
{    
    public function __construct(array $parameters)
    {
        // Initialize your context here
        // ...
        $this->useContext('SubContextA', new SubContextA($parameters));
        $this->useContext('SubContextB', new SubContextB($parameters));
    }
}

but the 3.0 branch is completely different from the context that is not distributed, they implement the SnippetAcceptingContext and use features like KernelDictionary, for example.

How can I use "subcontexts" in Behat 3.0, the documentation is really poor

+4
source share
1 answer

The documentation is really very bad. AFAIK, you have no subcontexts; instead, you can now define multiple contexts for each package.

# behat.yml

default:
    suites:
        domain_features:
            paths:    [ %paths.base%/features ]
            contexts: [ DomainContext ]
        web_features:
            paths:    [ %paths.base%/features ]
            contexts: [ WebContext ]
            filters:
                tags: @web
+6
source

All Articles