3.0beta1

## 3.0.0beta1

### Suites

If you ask any experienced behat users across the community what they miss most in v2, answers would differ:

- Ability to use different contexts against different features in one run
- Ability to test multiple bundles simultaneously with **Symfony2**Extension
- Ability to spread huge test suite execution across multiple machines

Those are really different needs. But there's one common things between all of them - it's an answer to the question "why it couldn't be done in v2?". The reason why none of those could be done in current stable version of behat is a context-first architecture of v2. You see, in v2 context is the main player of your suite - you run behat, it tries to find a context, reads all definitions and hooks from it and then simply executes features against it. Problem is all of the features in the list above require us to have multiple context instances inside same suite exercise. And that's exactly what v3 brings.

In v3 nor your contexts nor your features are first-class citizens of your test suite, suites are. Each behat exercise (single execution) could have one or more suites associated with it. And each suite could have one or more contexts and features associated with it. It means not only you could have multiple contexts in one suite - you could test same features against different context classes in one run. Here's how it looks like in reality: http://youtu.be/8RqFzqj79iY

Updates to all extensions across the board are coming. And yep, Symfony2Extension will have suites as a first class citizens too.

### Architecture

Second biggest change is the architecture of behat itself. Although v2 was quite an extensible tool, it was highly coupled and hard to move forward on its later stages of life. Behat v3 is a rethinking from a ground up using all the knowledge and design patterns I learned during last years. Basically, now entire behat is a set of services that just listen to appropriate event from the [huge list of ones available](https://github.com/Behat/Behat/blob/3.0/src/Behat/Behat/Event/EventInterface.php). Look for example at [DefinitionFinder](https://github.com/Behat/Behat/blob/3.0/src/Behat/Behat/Definition/EventSubscriber/DefinitionFinder.php) or [ArgumentsTransformer](https://github.com/Behat/Behat/blob/3.0/src/Behat/Behat/Transformation/EventSubscriber/ArgumentsTransformer.php). This kind of architecture makes behat not only the most flexible I've built to date, but also most extensible one. You remember chained steps? The ones where you could've just returned array of steps from your definition and behat would execute them one by one. Welp, I removed them and added back in form of extension. [One simple event subscriber](https://github.com/Behat/ChainedStepsExtension/blob/master/src/Behat/ChainedStepsExtension/Definition/EventSubscriber/ExecuteChainedSteps.php) kind of extension. And I hope to see more to come from amazing community that we have ;)

### Gone

You couldn't talk about cleaning up and refactoring something without taking something old and rusty away. There were some features in behat v2 that didn't quite fit to the core philosophy of the tool, thus were waiting for removal from the core in the next major version (this one).

- **Subcontexts** - basically, you don't need this abomination anymore as:
    1. we live in the world where php5.5 exists with traits
    2. behat is now multicontextual thanks to context pools
    
    But if you miss them really hard, it would be really-really easy to add them back in form of clean extension.
- **Chained steps** - I never actually liked chained steps. They moved your code further away from being clean and reliable and in most cases code with inline steps was longer and harder to read. That being said, I know that some of behat users really liked this feature, thus you can add them back by [installing this clean extension](https://github.com/Behat/ChainedStepsExtension).
- **Closured step definitions** - they were there just for BC sake for more than a year and now it's time to remove this for good. Still, if needed - community could easily add them back through extension system.

### Next steps

This is called `beta` even though thing is quite stable and clean already. The only reason why I'm not release 3.0.0 right now is that I need to update website, extensions and docs first. So that's exactly what I'm focusing right now and hopefully will be able to tackle in coming weeks. As of now, feel free to play with beta, write your extensions and send your pull requests. Keep 'em coming, guys!