SlideShare a Scribd company logo
1 of 49
Download to read offline
BDD REVOLUTION
OR HOW WE CAME BACK FROM HELL
@mpzalewski
Zales0123
MATEUSZ ZALEWSKI
@mpzalewski
Zales0123
mpzalewski.com
2
3
BEHAVIOUR 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.
https://inviqa.com/insights/bdd-guide
4
5
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
/**
* @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);
}
7
LESS AMBIGUITY
=
LESS MISUNDERSTANDINGS
8
9
Translation of
requirements
$$$
Poor
communication
10
11
12
13
14
15
16
https://www.theverge.com/2016/5/5/11592622/this-is-
fi
ne-meme-comic
17
18
@ui
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
19
SCENARIO CONTEXT
20
SCENARIO CONTEXT
21
22
EXTENSIONS
TRANSFORMERS
SCENARIO CONTEXT PAGE
API
UI
Application
FRIENDS OF BEHAT
23
24
25
GHERKIN STEP
PHP CODE
CONTEXT
26
/**
* @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));
}
27
VALUE
OBJECT
TRANSFORM
ER
28
/**
* @Transform /^coupon "([^"]+)"$/
* @Transform /^"([^"]+)" coupon$/
* @Transform :coupon
*/
public function getCouponByCode(string $couponCode): CouponInterface
{
$coupon = $this->couponRepository->findOneBy(['code' => $couponCode]);
Assert::notNull(
$coupon,
sprintf('Coupon with code "%s" does not exist', $couponCode)
);
return $coupon;
}
29
When I add this product to the cart
When I browse that channel
Then this item should have name "T-shirt banana"
30
PHP CODE
API
UI CLI
31
32
public function addToCartWithQuantity(string $quantity): void
{
$this->getElement('quantity')->setValue($quantity);
$this->getElement('add_to_cart_button’)->click();
}
2020
33
@ui @api
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
34
35
SCENARIO CONTEXT PAGE
API
UI
Application
36
SCENARIO
UI CONTEXT PAGE
UI
API CONTEXT CLIENT
37
SCENARIO
UI CONTEXT PAGE
UI
API CONTEXT CLIENT
?
When I add 4 products "PHP T-Shirt" to the cart
38
/**
* @When /^I add(?:|ed)(?:| again) (d+) (products "([^"]+)") to the cart$/
*/
public function iAddProductsToTheCart(int $quantity, ProductInterface $product)
{
$this->productShowPage->open(['slug' => $product->getSlug()]);
$this->productShowPage->addToCart();
}
/**
* @When /^I add(?:|ed)(?:| again) (d+) (products "([^"]+)") to the cart$/
*/
public function iAddProductsToTheCart(int $quantity, ProductInterface $product)
{
// ...
$this->shopClient->executeCustomRequest($request);
}
@ui
@api
curl -X 'POST' 
'https://demo.sylius.com/api/v2/shop/orders/4tRzg1O1eH/items' 
-H 'accept: application/ld+json' 
-H 'Content-Type: application/ld+json' 
-d '{
"productVariant": "/api/v2/shop/product-variants/Everyday_white_basic_T_Shirt-variant-0",
"quantity": 1
}'
!
40
2077
41
42
43
44
@ui @api @smell
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
45
@ui @api @cli @application @domain...
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
46
BUSINESS VALUE
CODE VALUE
47
Have no fear of perfection - you’ll never reach it.
~ Salvador Dali
48
THANK YOU
QR CODE
@CommerceWeavers
@Sylius QR CODE
@mpzalewski Zales0123

More Related Content

Similar to Confoo 2023 - BDD revolution, or how we came back from hell

Google Analytics as Database of Record
Google Analytics as Database of RecordGoogle Analytics as Database of Record
Google Analytics as Database of RecordDavy Tollenaere
 
Billing in a supermarket c++
Billing in a supermarket c++Billing in a supermarket c++
Billing in a supermarket c++varun arora
 
How to integrate paytm payment gateway using react js in seven easy steps
How to integrate paytm payment gateway using react js in seven easy stepsHow to integrate paytm payment gateway using react js in seven easy steps
How to integrate paytm payment gateway using react js in seven easy stepsKaty Slemon
 
Computer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market BillingComputer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market BillingHarsh Kumar
 
TechSupportCh 21 project.doc1Projects.doc Project 21-.docx
TechSupportCh 21 project.doc1Projects.doc Project 21-.docxTechSupportCh 21 project.doc1Projects.doc Project 21-.docx
TechSupportCh 21 project.doc1Projects.doc Project 21-.docxmattinsonjanel
 
computerscience-170129081612.pdf
computerscience-170129081612.pdfcomputerscience-170129081612.pdf
computerscience-170129081612.pdfKiranKumari204016
 
Monetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetMonetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetPhil Pearce
 
BDD in practice based on an open source project
BDD in practice based on an open source projectBDD in practice based on an open source project
BDD in practice based on an open source projectŁukasz Chruściel
 
I finished most of the program, but having trouble with some key fea.pdf
I finished most of the program, but having trouble with some key fea.pdfI finished most of the program, but having trouble with some key fea.pdf
I finished most of the program, but having trouble with some key fea.pdfhardjasonoco14599
 
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20CodeValue
 
Observability and more architecture next 2020
Observability and more   architecture next 2020Observability and more   architecture next 2020
Observability and more architecture next 2020Alon Fliess
 
Flamingo Commerce Module Details
Flamingo Commerce Module DetailsFlamingo Commerce Module Details
Flamingo Commerce Module Detailsi-love-flamingo
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Python Ireland
 
[PHPCon 2023] Blaski i cienie BDD
[PHPCon 2023] Blaski i cienie BDD[PHPCon 2023] Blaski i cienie BDD
[PHPCon 2023] Blaski i cienie BDDMateusz Zalewski
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019Paul Shapiro
 
Mass2 Lean2 Six Sigma
Mass2 Lean2 Six SigmaMass2 Lean2 Six Sigma
Mass2 Lean2 Six Sigmaguestb2a38a
 
An Online Food Ordering Service
An Online Food Ordering ServiceAn Online Food Ordering Service
An Online Food Ordering Serviceshreeram38
 
Enhanced ecommerce tracking
Enhanced ecommerce trackingEnhanced ecommerce tracking
Enhanced ecommerce trackingEtietop Demas
 

Similar to Confoo 2023 - BDD revolution, or how we came back from hell (20)

Google Analytics as Database of Record
Google Analytics as Database of RecordGoogle Analytics as Database of Record
Google Analytics as Database of Record
 
Billing in a supermarket c++
Billing in a supermarket c++Billing in a supermarket c++
Billing in a supermarket c++
 
How to integrate paytm payment gateway using react js in seven easy steps
How to integrate paytm payment gateway using react js in seven easy stepsHow to integrate paytm payment gateway using react js in seven easy steps
How to integrate paytm payment gateway using react js in seven easy steps
 
Computer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market BillingComputer science class 12 project on Super Market Billing
Computer science class 12 project on Super Market Billing
 
TechSupportCh 21 project.doc1Projects.doc Project 21-.docx
TechSupportCh 21 project.doc1Projects.doc Project 21-.docxTechSupportCh 21 project.doc1Projects.doc Project 21-.docx
TechSupportCh 21 project.doc1Projects.doc Project 21-.docx
 
computerscience-170129081612.pdf
computerscience-170129081612.pdfcomputerscience-170129081612.pdf
computerscience-170129081612.pdf
 
Monetate Implementation Cheat Sheet
Monetate Implementation Cheat SheetMonetate Implementation Cheat Sheet
Monetate Implementation Cheat Sheet
 
BDD in practice based on an open source project
BDD in practice based on an open source projectBDD in practice based on an open source project
BDD in practice based on an open source project
 
I finished most of the program, but having trouble with some key fea.pdf
I finished most of the program, but having trouble with some key fea.pdfI finished most of the program, but having trouble with some key fea.pdf
I finished most of the program, but having trouble with some key fea.pdf
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
 
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
Alon Fliess: APM – What Is It, and Why Do I Need It? - Architecture Next 20
 
Observability and more architecture next 2020
Observability and more   architecture next 2020Observability and more   architecture next 2020
Observability and more architecture next 2020
 
E-Bazaar
E-BazaarE-Bazaar
E-Bazaar
 
Flamingo Commerce Module Details
Flamingo Commerce Module DetailsFlamingo Commerce Module Details
Flamingo Commerce Module Details
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
[PHPCon 2023] Blaski i cienie BDD
[PHPCon 2023] Blaski i cienie BDD[PHPCon 2023] Blaski i cienie BDD
[PHPCon 2023] Blaski i cienie BDD
 
How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019How to Leverage APIs for SEO #TTTLive2019
How to Leverage APIs for SEO #TTTLive2019
 
Mass2 Lean2 Six Sigma
Mass2 Lean2 Six SigmaMass2 Lean2 Six Sigma
Mass2 Lean2 Six Sigma
 
An Online Food Ordering Service
An Online Food Ordering ServiceAn Online Food Ordering Service
An Online Food Ordering Service
 
Enhanced ecommerce tracking
Enhanced ecommerce trackingEnhanced ecommerce tracking
Enhanced ecommerce tracking
 

Recently uploaded

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

Confoo 2023 - BDD revolution, or how we came back from hell