There are a wide range of extensions already available. These include integrations with common PHP application frameworks, browser automation, test result reporters, data fixtures and many more.
We do not currently maintain an official list of extensions - most extensions can be found on GitHub.
More information on integrating Behat with PHPStorm can be found in this blog post.
A proper assertion tool is a library whose assertions throw exceptions on failure.
For example a list of the most known:
- https://github.com/webmozarts/assert
- https://github.com/beberlei/assert
- https://github.com/zenstruck/assert
Caution with PHPUnit
If you are familiar with PHPUnit, you can use its assertion library
$ php composer.phar require --dev phpunit/phpunitand then by simply using assertions in your steps:
\PHPUnit\Framework\Assert::assertCount(
intval($count),
$this->basket
);WARNING: using PHPUnit for assertions no longer works with PHP 11.3.0 and later out-of-the-box.
This is due to a change in how PHPUnit's internal components are initialized. The recommended workaround
to use the PHPUnit assertions is to bootstrap PHPUnit during Behat execution from a BeforeSuite hook:
use Behat\Hook\BeforeSuite;
class FeatureContext {
#[BeforeSuite]
public static function initPhpunit() {
(new \PHPUnit\TextUI\Configuration\Builder())->build([]);
}
}If you have multiple suites, you may want to use a static variable in the hook to ensure the initialization only runs once.
Learn more at Behat/Behat#1618.
An interesting Behat and Mink cheat sheet developed by Jean-François Lépine