In modern application development process, testing is not only an addition. Methodologies like TDD or BDD requires time for tests architecture preparation, to make the automatic testing process as fast and extendable as possible.
One of the best examples of proper testing suite revolution is Behat system from open-source eCommerce project Sylius (https://github.com/Sylius/Sylius), which has been entirely rebuilt in the recent past.
In my talk, I will present the most significant problems which we had defined in previous UI tests and conclusions we¡¯ve deduced from them. I will also show a way, how we¡¯ve rewritten the tests system, using powerful, often not widely known, mechanisms and patterns. I will explain the whole architecture of the new Behat system in Sylius, which helps us to build new, adequately tested functionalities, in the most efficient way.
1 of 34
Download to read offline
More Related Content
BDD revolution - or how we came back from hell
1. BEHAT REVOLUTION
OR HOW WE CAME BACK FROM HELL
@mpzalewski
https://github.com/Zales0123
MATEUSZ ZALEWSKI
4. BDD is a process designed to aid the management and the delivery of software
development projects by improving communication between engineers and
business professionals.
BEHAVIOR DRIVEN
DEVELOPMENT
BDD is a process designed to aid the management and the delivery of software
development projects by improving communication between engineers and
business professionals.
BEHAVIOR DRIVEN
DEVELOPMENT
http://inviqa.com/insights/bdd-guide4
6. Given "PHP T-Shirt" is priced at €100.00
And the store has "VAT" tax rate of 23%
When I add product "PHP T-Shirt" to the cart
Then my cart taxes should be €23.00
6
7. 7
/**
* @Given :product is priced at :price
*/
public function productIsPricedAt(ProductInterface $product, int $price): void
{
$product->setPrice($price);
}
/**
* @Then /^(my cart) taxes should be ("[^"]+")$/
*/
public function myCartTaxesShouldBe(CartInterface $cart, int $money): void
{
Assert::eq($cart->getTaxesTotal(), $money);
}
23. /**
* @When I choose :countryName
*/
public function iChoose(string $countryName): void
{
$this->createPage->chooseName($countryName);
}
/**
* @When I save my changes
* @When I try to save changes
*/
public function iSaveMyChanges(): void
{
$this->updatePage->saveChanges();
}
/**
* @Then I should not be able to choose :name
*/
public function iShouldNotBeAbleToChoose(string $name): void
{
try {
$this->createPage->chooseName($name);
} catch (ElementNotFoundException $exception) {
return;
}
throw new Exception(sprintf('I should not be able to choose "%s".', $name));
}
23