SlideShare a Scribd company logo
Continuous
Behavior
BDD in Continuous Delivery
CoDers Who Test
15th May 2018
Gáspár Nagy
coach • trainer • bdd addict • creator of specflow
“The BDD Books: Discovery” • http://bddbooks.com
@gasparnagy • gaspar@specsolutions.eu
Continuous Behavior - BDD in Continuous Delivery (CoDers Who Test, Gothenburg, 15/5/2018)
Copyright © Gaspar NagyCopyright © Gaspar Nagy
bdd addict
given.when.then
CAUTION!
on the stage
Gáspár Nagy
coach, trainer and bdd addict
creator of SpecFlow
gaspar@specsolutions.eu
https://specsolutions.eu
@gasparnagy
Copyright © Gaspar NagyCopyright © Gaspar Nagy
What makes you nervous on
the day of the release?
My first app…
A long time ago* in a galaxy
far, far away**…
* 1995
** Veszprém, Hungary
Continuous Behavior - BDD in Continuous Delivery (CoDers Who Test, Gothenburg, 15/5/2018)
Copyright © Gaspar NagyCopyright © Gaspar Nagy
My dream-projects in 1995
• Working software that was in use
• Exciting technical solutions
• Continuous learning
• And no conflicts in the team…
…because I was alone
Copyright © Gaspar NagyCopyright © Gaspar Nagy
My first “real” project…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Practicing team work
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Practicing team work
And by a
modem for
“A”
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Integration is more than merging…
changed
foo.cpp
changed
bar.cpp
?
void ProcessOrder()
{
…
+ account->Withdraw(sum);
…
}
void FinalizeOrder()
{
…
+ account->Withdraw(sum);
…
}
Copyright © Gaspar NagyCopyright © Gaspar Nagy
What is integration, then?
Ensuring that the improvements developed independently still form a working unit
Resolving file-
level conflicts
Can compile,
can build
Can be
deployed
There is no
regression
[Enter your
specific step
here]
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Proper integration is difficult…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Frequency reduces difficulty (Fowler)
• „if it hurts, do it more often”
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous Integration, CI
Ensures that the improvements developed independently still form a working unit
• Resolving file-level conflicts
• Compilation, build
• Unit tests
• ...
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous integration revealed the next
problems…
• Manual regression testing does not scale…
• Manual deployments are error-prone…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous Delivery, CD
Ensures that the application is always in a potentially deployable state (whether we
deploy is a manual decision)
• CI +
• Deployable
• Automated regression tests
(Acceptance Tests)
• ...
Copyright © Gaspar NagyCopyright © Gaspar Nagy
CD vs. CD
Continuous Delivery vs. Continuous Deployment
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous Delivery, Continuous Deployment
Copyright © Gaspar NagyCopyright © Gaspar Nagy
“Continues delivery can be achieved by anyone,
Continues deployment is only for some specific
products…”
/some people/
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous Deployment, CD
Ensures that the application is always actual
• CD +
• Fully* automated verification
• Automated non-functional tests
• Appropriate context (eg. SaaS)
• ...
• ???
„live”
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous Deployment is the key to understand the
“CD” mentality…
…so let’s try!
Copyright © Gaspar NagyCopyright © Gaspar Nagy
What are your fears?
• I am afraid of pushing the “release” button!
• The feedback I get from my tests are not useful!
Copyright © Gaspar NagyCopyright © Gaspar Nagy
More testing and more automation!
Source: World Quality Report 2015/16
increased by 35%
increased by 60%
0%
5%
10%
15%
20%
25%
30%
35%
40%
45%
50%
Amount of IT budget allocated to QA Ratio of test case automation
2014
2015
Small tests = small problems;
Big tests = big problems
• They are SLOOOOOOW!
• They are BRITTLE!
• They need awful lot of MAINTENANCE!
• They FAIL!!!
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Our typical automated tests are
not good enough for CD…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
What’s wrong with our tests?
Episode #1
PO: We have far too many prod issues. We have
to improve our CD pipeline…
Write more tests!
Team: How much more?
Episode #2
PO: Are your tests balanced according to the test
automation pyramid?
Team: … not fully…, more like an ice-cream cone
PO: Then write more unit tests!
Episode #3
PO: You should increase your test coverage!
Team: You mean line coverage? How much?
PO: Well… what is exactly a code line doing?
Episode #4
PO: You should cover the risks better!
Team: How do we know if we have covered
them?
Copyright © Gaspar NagyCopyright © Gaspar Nagy
PO controlling testing activities…
Problem Domain Solution Domain
Lightbulb by Unknown Author is licensed under CC BY-SA
PO
REQ APP
TESTS
Copyright © Gaspar NagyCopyright © Gaspar Nagy
You cannot control something that is
outside of your control…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Tests should be part of shared ownership…
Problem Domain Solution Domain
Lightbulb by Unknown Author is licensed under CC BY-SA
REQ APP
TESTS
Copyright © Gaspar NagyCopyright © Gaspar Nagy
How could the entire team
own the tests?
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Tests should be part of shared ownership…
Problem Domain Solution Domain
Lightbulb by Unknown Author is licensed under CC BY-SA
The old PIN
should be
correct
public void VerifyOldPin(string enteredOldPin)
{
var db = new CardRespoitory();
var oldPin = db.LoadOldPin(CurrentCard);
if (oldPin != enteredOldPin)
{
throw new InvalidPinException();
}
}
Implements
[TestMethod]
public void ShuldFailWhenOldPinIncorrect()
{
var cardStoreMock = new CardStoreMock();
cardStoreMock.SetCard("1234678", "1234");
var sut = new CardService();
var result = sut.ChangePin("1234678", "1111",
"1212", "1212");
Assert.IsFalse(result);
}
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Specification by example
Problem Domain Solution Domain
Lightbulb by Unknown Author is licensed under CC BY-SA
The old PIN
should be
correct
public void VerifyOldPin(string enteredOldPin)
{
var db = new CardRespoitory();
var oldPin = db.LoadOldPin(CurrentCard);
if (oldPin != enteredOldPin)
{
throw new InvalidPinException();
}
}
Implements
[TestMethod]
public void ShuldFailWhenOldPinIncorrect()
{
var cardStoreMock = new CardStoreMock();
cardStoreMock.SetCard("1234678", "1234");
var sut = new CardService();
var result = sut.ChangePin("1234678", "1111",
"1212", "1212");
Assert.IsFalse(result);
}
Old PIN is incorrect
• PIN is 1234
• Enter old PIN: 1111
• Change PIN
⇒ PIN change rejected
Illustrates
Automates
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Codified tests are hard to maintain
• What was the example?
• Why were these
numbers used?
• What did we want to
verify?
[TestMethod]
public void ShuldFailWhenOldPinIncorrect()
{
var cardStoreMock = new CardStoreMock();
cardStoreMock.SetCard("1234678", "1234");
var sut = new CardService();
var result = sut.ChangePin("1234678", "1111",
"1212", "1212");
Assert.IsFalse(result);
}
Copyright © Gaspar NagyCopyright © Gaspar Nagy
BDD is here to help?
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Formulated BDD scenarios
Problem Domain Solution Domain
The old PIN
should be
correct
public void VerifyOldPin(string enteredOldPin)
{
var db = new CardRespoitory();
var oldPin = db.LoadOldPin(CurrentCard);
if (oldPin != enteredOldPin)
{
throw new InvalidPinException();
}
}
Implements
Old PIN is incorrect
• PIN is 1234
• Enter old PIN: 1111
• Change PIN
⇒ PIN change rejected
Illustrates
Scenario: Old PIN is incorrect
Given my old pin is 1234
And I enter 1111 as old PIN
When I try to change my PIN
Then the PIN change should be rejected [Then]
public void I_enter_PIN_as_old_pin(string pin)
{
changePinContext.SetOldPin(pin);
}
[When]
public void I_enter_PIN_as_old_pin(string pin)
{
changePinContext.SetOldPin(pin);
}
[Given]
public void I_enter_PIN_as_old_pin(string pin)
{
changePinContext.SetOldPin(pin);
}
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Behavior Driven Development
Problem Domain Solution Domain
Lightbulb by Unknown Author is licensed under CC BY-SA
REQ APP
Given
When
Then
SPECS
Validates Verifies
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Behavior Driven Development is about
understanding & validating
business requirements
through illustrative examples
Copyright © Gaspar NagyCopyright © Gaspar Nagy
BDD is not about tests!
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Functional quality is not only about whether
IT WORKS as expected…
but also about
whether the EXPECTATIONS ARE GOOD and
DOCUMENTED…
Functional quality
Episode in a later season…
PO: We have got a strange prod issue. Could we
look into that?
Team: Sure. Let’s have a look at the related BDD
scenarios…
PO: I see. I think there is an important case we
did not detail enough…
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Happy ending
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Finally I’ve got a dream-project again
• It was a complex service used by hundreds of apps and through them millions of
users all over the world
• Processed several thousands of requests per second
• Was critical in the client’s service chain
• We rolled it out without any severe issues…
• And we knew that there will be no problems…
• Because we had shared control over the specs (BDD scenarios)
• And this gave us confidence to push the release button
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Continuous deployment is about CONFIDENCE
…and you need to keep the link to the problem
domain to gain that
Why was my first project working?
• Short cycles
• Instant release
• Close to “business” but also
close to users
Copyright © Gaspar NagyCopyright © Gaspar Nagy
Think about YOUR tests…
Are they also linking the solution with the problem?
Source: https://shashinki.com/
Thank you!
Gáspár Nagy
coach • trainer • bdd addict • creator of specflow
“The BDD Books: Discovery” • http://bddbooks.com
@gasparnagy • gaspar@specsolutions.eu
Copyright © Gaspar NagyCopyright © Gaspar Nagy

More Related Content

PDF
We are sinking: Hitting the testing iceberg (CukenFest London, 2018)
PDF
BDD Scenarios in a Testing & Traceability Strategy (Webinar 19/02/2021)
PDF
Scaffolding a legacy app with BDD scenario (Agile in the City Bristol 2017)
PPTX
ATAGTR2017 CDC Tests - Integration Tests cant be made simpler than this!
PDF
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (HUSTEF 2...
PDF
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (BDD Lond...
PPTX
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
PPTX
TUI & qTest: Why, How and Where Next
We are sinking: Hitting the testing iceberg (CukenFest London, 2018)
BDD Scenarios in a Testing & Traceability Strategy (Webinar 19/02/2021)
Scaffolding a legacy app with BDD scenario (Agile in the City Bristol 2017)
ATAGTR2017 CDC Tests - Integration Tests cant be made simpler than this!
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (HUSTEF 2...
Scaffolding a legacy app with BDD scenarios using SpecFlow/Cucumber (BDD Lond...
Kimmo Hakala. Comaqa Spring 2018. Challenges and good QA practices in softwar...
TUI & qTest: Why, How and Where Next

What's hot (20)

PDF
How Optimizely Scaled its REST API with asyncio
PPTX
Agile Testing Analytics
PPTX
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
ODP
Definition of Done
PDF
What do you mean, Agile?
PPTX
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
PPTX
QA Fest 2017. Ирина Жилинская. Тестирование основанное на рисках в реальности...
PDF
GASPing Toward the Future: A Look at What’s In Store for Scrum
PPTX
DOES16 San Francisco - David Blank-Edelman - Lessons Learned from a Parallel ...
PPTX
A Guide to Event-Driven SRE-inspired DevOps
PPTX
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
PDF
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
PPTX
Making the Move to Behavior Driven Development
PPTX
Evolve or Die: Healthcare IT Testing | QASymphony Webinar
PDF
Scrum in Hardware
PDF
Atlassian user group in itiviti
PPT
Integrated Dev And Qa Team With Scrum
PPTX
Let's focus more on Quality and less on Testing by Joel Montvelisky
PPTX
Accelerating Your Test Execution Pipeline
PDF
ATAGTR2017 What Lies Beneath Robotics Process Automation
How Optimizely Scaled its REST API with asyncio
Agile Testing Analytics
Optimizely NYC Developer Meetup - Experimentation at Blue Apron
Definition of Done
What do you mean, Agile?
QASymphony and TestPlant: Bringing Together Best-in-Class Test Management and...
QA Fest 2017. Ирина Жилинская. Тестирование основанное на рисках в реальности...
GASPing Toward the Future: A Look at What’s In Store for Scrum
DOES16 San Francisco - David Blank-Edelman - Lessons Learned from a Parallel ...
A Guide to Event-Driven SRE-inspired DevOps
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
Continuous Deployment To The Cloud With Spring Cloud Pipelines @WarsawCloudNa...
Making the Move to Behavior Driven Development
Evolve or Die: Healthcare IT Testing | QASymphony Webinar
Scrum in Hardware
Atlassian user group in itiviti
Integrated Dev And Qa Team With Scrum
Let's focus more on Quality and less on Testing by Joel Montvelisky
Accelerating Your Test Execution Pipeline
ATAGTR2017 What Lies Beneath Robotics Process Automation
Ad

Similar to Continuous Behavior - BDD in Continuous Delivery (CoDers Who Test, Gothenburg, 15/5/2018) (20)

PDF
Test & behavior driven development
PPTX
An Introduction To Software Development - Test Driven Development, Part 1
PDF
How BDD enables True CI/CD
PDF
Software Testing Maturity Model and Assessment by Abstracta
PDF
Real developers-dont-need-unit-tests
PDF
Real developers-dont-need-unit-tests
PDF
Real developers-dont-need-unit-tests
PDF
What CS Class Didn't Teach About Testing
PPTX
Test driven development
PDF
Continuous Delivery Testing @HiQ
PPT
AAA Automated Testing
PDF
Evolve your coding with some BDD
PPTX
An Introduction To Software Development - Test Driven Development
ODP
Effective TDD - Less is more
PPTX
TDD - Seriously, try it - Codemotion (May '24)
PPTX
Test-Driven Development
PDF
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
PPTX
Gateway to Agile: XP and BDD
PPT
Test driven-development
PDF
Continuous delivery is more than dev ops
Test & behavior driven development
An Introduction To Software Development - Test Driven Development, Part 1
How BDD enables True CI/CD
Software Testing Maturity Model and Assessment by Abstracta
Real developers-dont-need-unit-tests
Real developers-dont-need-unit-tests
Real developers-dont-need-unit-tests
What CS Class Didn't Teach About Testing
Test driven development
Continuous Delivery Testing @HiQ
AAA Automated Testing
Evolve your coding with some BDD
An Introduction To Software Development - Test Driven Development
Effective TDD - Less is more
TDD - Seriously, try it - Codemotion (May '24)
Test-Driven Development
Joe Cisar - Everything I Know About TDD - Agile Midwest 2019
Gateway to Agile: XP and BDD
Test driven-development
Continuous delivery is more than dev ops
Ad

More from Gáspár Nagy (15)

PDF
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
PDF
BDD Scenarios in a Testing Strategy
PDF
Ramp up your testing solution, ExpoQA 2023
PDF
Fighting against technical debt (CukenFest 2020)
PDF
Süllyedünk! Ütközés a tesztelési jégheggyel (Teszt & Tea Meeup Budapest, 2018...
PDF
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
PDF
Testing is Difficult (Agile in the City Bristol 2017, Lightening talk)
PDF
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (Qualit...
PDF
A tesztelés szerepe folyamatos kihelyezést használó projektekben (Microsoft, ...
PDF
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
PDF
Property Based BDD Examples (ETSI UCAAT 2016, Budapest)
PDF
Given/When/Then-ready sprint planning with Example Mapping (Agilia Budapest 2...
PDF
Introducing BDD to Legacy Applications with SpecFlow/Cucumber (Agilia Confere...
PDF
Folyamatos integráció és kódépítés (ALM Day Budapest, 24/11/2015, Hungarian)
PDF
Given/When/Then-ready sprint planning (Agile Tour Vienna 2015)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
BDD Scenarios in a Testing Strategy
Ramp up your testing solution, ExpoQA 2023
Fighting against technical debt (CukenFest 2020)
Süllyedünk! Ütközés a tesztelési jégheggyel (Teszt & Tea Meeup Budapest, 2018...
Behavior Driven UI Automation (Agile Testing Days 2017, Potsdam)
Testing is Difficult (Agile in the City Bristol 2017, Lightening talk)
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (Qualit...
A tesztelés szerepe folyamatos kihelyezést használó projektekben (Microsoft, ...
Behavior Driven Web UI Automation with Selenium and Cucumber/SpecFlow (BDDx L...
Property Based BDD Examples (ETSI UCAAT 2016, Budapest)
Given/When/Then-ready sprint planning with Example Mapping (Agilia Budapest 2...
Introducing BDD to Legacy Applications with SpecFlow/Cucumber (Agilia Confere...
Folyamatos integráció és kódépítés (ALM Day Budapest, 24/11/2015, Hungarian)
Given/When/Then-ready sprint planning (Agile Tour Vienna 2015)

Recently uploaded (20)

PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Introduction to Artificial Intelligence
PDF
System and Network Administration Chapter 2
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
top salesforce developer skills in 2025.pdf
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
System and Network Administraation Chapter 3
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Wondershare Filmora 15 Crack With Activation Key [2025
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Design an Analysis of Algorithms II-SECS-1021-03
Which alternative to Crystal Reports is best for small or large businesses.pdf
Understanding Forklifts - TECH EHS Solution
Introduction to Artificial Intelligence
System and Network Administration Chapter 2
Navsoft: AI-Powered Business Solutions & Custom Software Development
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
2025 Textile ERP Trends: SAP, Odoo & Oracle
Softaken Excel to vCard Converter Software.pdf
top salesforce developer skills in 2025.pdf
Reimagine Home Health with the Power of Agentic AI​
System and Network Administraation Chapter 3
How to Migrate SBCGlobal Email to Yahoo Easily
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf

Continuous Behavior - BDD in Continuous Delivery (CoDers Who Test, Gothenburg, 15/5/2018)

  • 1. Continuous Behavior BDD in Continuous Delivery CoDers Who Test 15th May 2018 Gáspár Nagy coach • trainer • bdd addict • creator of specflow “The BDD Books: Discovery” • http://bddbooks.com @gasparnagy • gaspar@specsolutions.eu
  • 3. Copyright © Gaspar NagyCopyright © Gaspar Nagy bdd addict given.when.then CAUTION! on the stage Gáspár Nagy coach, trainer and bdd addict creator of SpecFlow gaspar@specsolutions.eu https://specsolutions.eu @gasparnagy
  • 4. Copyright © Gaspar NagyCopyright © Gaspar Nagy What makes you nervous on the day of the release?
  • 6. A long time ago* in a galaxy far, far away**… * 1995 ** Veszprém, Hungary
  • 8. Copyright © Gaspar NagyCopyright © Gaspar Nagy My dream-projects in 1995 • Working software that was in use • Exciting technical solutions • Continuous learning • And no conflicts in the team… …because I was alone
  • 9. Copyright © Gaspar NagyCopyright © Gaspar Nagy My first “real” project…
  • 10. Copyright © Gaspar NagyCopyright © Gaspar Nagy Practicing team work
  • 11. Copyright © Gaspar NagyCopyright © Gaspar Nagy Practicing team work And by a modem for “A”
  • 12. Copyright © Gaspar NagyCopyright © Gaspar Nagy Integration is more than merging… changed foo.cpp changed bar.cpp ? void ProcessOrder() { … + account->Withdraw(sum); … } void FinalizeOrder() { … + account->Withdraw(sum); … }
  • 13. Copyright © Gaspar NagyCopyright © Gaspar Nagy What is integration, then? Ensuring that the improvements developed independently still form a working unit Resolving file- level conflicts Can compile, can build Can be deployed There is no regression [Enter your specific step here]
  • 14. Copyright © Gaspar NagyCopyright © Gaspar Nagy Proper integration is difficult…
  • 15. Copyright © Gaspar NagyCopyright © Gaspar Nagy Frequency reduces difficulty (Fowler) • „if it hurts, do it more often”
  • 16. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous Integration, CI Ensures that the improvements developed independently still form a working unit • Resolving file-level conflicts • Compilation, build • Unit tests • ...
  • 17. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous integration revealed the next problems… • Manual regression testing does not scale… • Manual deployments are error-prone…
  • 18. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous Delivery, CD Ensures that the application is always in a potentially deployable state (whether we deploy is a manual decision) • CI + • Deployable • Automated regression tests (Acceptance Tests) • ...
  • 19. Copyright © Gaspar NagyCopyright © Gaspar Nagy CD vs. CD Continuous Delivery vs. Continuous Deployment
  • 20. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous Delivery, Continuous Deployment
  • 21. Copyright © Gaspar NagyCopyright © Gaspar Nagy “Continues delivery can be achieved by anyone, Continues deployment is only for some specific products…” /some people/
  • 22. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous Deployment, CD Ensures that the application is always actual • CD + • Fully* automated verification • Automated non-functional tests • Appropriate context (eg. SaaS) • ... • ??? „live”
  • 23. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous Deployment is the key to understand the “CD” mentality… …so let’s try!
  • 24. Copyright © Gaspar NagyCopyright © Gaspar Nagy What are your fears? • I am afraid of pushing the “release” button! • The feedback I get from my tests are not useful!
  • 25. Copyright © Gaspar NagyCopyright © Gaspar Nagy More testing and more automation! Source: World Quality Report 2015/16 increased by 35% increased by 60% 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% Amount of IT budget allocated to QA Ratio of test case automation 2014 2015
  • 26. Small tests = small problems; Big tests = big problems • They are SLOOOOOOW! • They are BRITTLE! • They need awful lot of MAINTENANCE! • They FAIL!!!
  • 27. Copyright © Gaspar NagyCopyright © Gaspar Nagy Our typical automated tests are not good enough for CD…
  • 28. Copyright © Gaspar NagyCopyright © Gaspar Nagy What’s wrong with our tests?
  • 29. Episode #1 PO: We have far too many prod issues. We have to improve our CD pipeline… Write more tests! Team: How much more?
  • 30. Episode #2 PO: Are your tests balanced according to the test automation pyramid? Team: … not fully…, more like an ice-cream cone PO: Then write more unit tests!
  • 31. Episode #3 PO: You should increase your test coverage! Team: You mean line coverage? How much? PO: Well… what is exactly a code line doing?
  • 32. Episode #4 PO: You should cover the risks better! Team: How do we know if we have covered them?
  • 33. Copyright © Gaspar NagyCopyright © Gaspar Nagy PO controlling testing activities… Problem Domain Solution Domain Lightbulb by Unknown Author is licensed under CC BY-SA PO REQ APP TESTS
  • 34. Copyright © Gaspar NagyCopyright © Gaspar Nagy You cannot control something that is outside of your control…
  • 35. Copyright © Gaspar NagyCopyright © Gaspar Nagy Tests should be part of shared ownership… Problem Domain Solution Domain Lightbulb by Unknown Author is licensed under CC BY-SA REQ APP TESTS
  • 36. Copyright © Gaspar NagyCopyright © Gaspar Nagy How could the entire team own the tests?
  • 37. Copyright © Gaspar NagyCopyright © Gaspar Nagy Tests should be part of shared ownership… Problem Domain Solution Domain Lightbulb by Unknown Author is licensed under CC BY-SA The old PIN should be correct public void VerifyOldPin(string enteredOldPin) { var db = new CardRespoitory(); var oldPin = db.LoadOldPin(CurrentCard); if (oldPin != enteredOldPin) { throw new InvalidPinException(); } } Implements [TestMethod] public void ShuldFailWhenOldPinIncorrect() { var cardStoreMock = new CardStoreMock(); cardStoreMock.SetCard("1234678", "1234"); var sut = new CardService(); var result = sut.ChangePin("1234678", "1111", "1212", "1212"); Assert.IsFalse(result); }
  • 38. Copyright © Gaspar NagyCopyright © Gaspar Nagy Specification by example Problem Domain Solution Domain Lightbulb by Unknown Author is licensed under CC BY-SA The old PIN should be correct public void VerifyOldPin(string enteredOldPin) { var db = new CardRespoitory(); var oldPin = db.LoadOldPin(CurrentCard); if (oldPin != enteredOldPin) { throw new InvalidPinException(); } } Implements [TestMethod] public void ShuldFailWhenOldPinIncorrect() { var cardStoreMock = new CardStoreMock(); cardStoreMock.SetCard("1234678", "1234"); var sut = new CardService(); var result = sut.ChangePin("1234678", "1111", "1212", "1212"); Assert.IsFalse(result); } Old PIN is incorrect • PIN is 1234 • Enter old PIN: 1111 • Change PIN ⇒ PIN change rejected Illustrates Automates
  • 39. Copyright © Gaspar NagyCopyright © Gaspar Nagy Codified tests are hard to maintain • What was the example? • Why were these numbers used? • What did we want to verify? [TestMethod] public void ShuldFailWhenOldPinIncorrect() { var cardStoreMock = new CardStoreMock(); cardStoreMock.SetCard("1234678", "1234"); var sut = new CardService(); var result = sut.ChangePin("1234678", "1111", "1212", "1212"); Assert.IsFalse(result); }
  • 40. Copyright © Gaspar NagyCopyright © Gaspar Nagy BDD is here to help?
  • 41. Copyright © Gaspar NagyCopyright © Gaspar Nagy Formulated BDD scenarios Problem Domain Solution Domain The old PIN should be correct public void VerifyOldPin(string enteredOldPin) { var db = new CardRespoitory(); var oldPin = db.LoadOldPin(CurrentCard); if (oldPin != enteredOldPin) { throw new InvalidPinException(); } } Implements Old PIN is incorrect • PIN is 1234 • Enter old PIN: 1111 • Change PIN ⇒ PIN change rejected Illustrates Scenario: Old PIN is incorrect Given my old pin is 1234 And I enter 1111 as old PIN When I try to change my PIN Then the PIN change should be rejected [Then] public void I_enter_PIN_as_old_pin(string pin) { changePinContext.SetOldPin(pin); } [When] public void I_enter_PIN_as_old_pin(string pin) { changePinContext.SetOldPin(pin); } [Given] public void I_enter_PIN_as_old_pin(string pin) { changePinContext.SetOldPin(pin); }
  • 42. Copyright © Gaspar NagyCopyright © Gaspar Nagy Behavior Driven Development Problem Domain Solution Domain Lightbulb by Unknown Author is licensed under CC BY-SA REQ APP Given When Then SPECS Validates Verifies
  • 43. Copyright © Gaspar NagyCopyright © Gaspar Nagy Behavior Driven Development is about understanding & validating business requirements through illustrative examples
  • 44. Copyright © Gaspar NagyCopyright © Gaspar Nagy BDD is not about tests!
  • 45. Copyright © Gaspar NagyCopyright © Gaspar Nagy Functional quality is not only about whether IT WORKS as expected… but also about whether the EXPECTATIONS ARE GOOD and DOCUMENTED… Functional quality
  • 46. Episode in a later season… PO: We have got a strange prod issue. Could we look into that? Team: Sure. Let’s have a look at the related BDD scenarios… PO: I see. I think there is an important case we did not detail enough…
  • 47. Copyright © Gaspar NagyCopyright © Gaspar Nagy Happy ending
  • 48. Copyright © Gaspar NagyCopyright © Gaspar Nagy Finally I’ve got a dream-project again • It was a complex service used by hundreds of apps and through them millions of users all over the world • Processed several thousands of requests per second • Was critical in the client’s service chain • We rolled it out without any severe issues… • And we knew that there will be no problems… • Because we had shared control over the specs (BDD scenarios) • And this gave us confidence to push the release button
  • 49. Copyright © Gaspar NagyCopyright © Gaspar Nagy Continuous deployment is about CONFIDENCE …and you need to keep the link to the problem domain to gain that
  • 50. Why was my first project working? • Short cycles • Instant release • Close to “business” but also close to users
  • 51. Copyright © Gaspar NagyCopyright © Gaspar Nagy Think about YOUR tests… Are they also linking the solution with the problem?
  • 53. Thank you! Gáspár Nagy coach • trainer • bdd addict • creator of specflow “The BDD Books: Discovery” • http://bddbooks.com @gasparnagy • gaspar@specsolutions.eu
  • 54. Copyright © Gaspar NagyCopyright © Gaspar Nagy