SlideShare a Scribd company logo
1 of 17
BDD with
Ruby
Gherkin
Cucumber
Capybara
Gabi Kis
TDT - July 3, 2013
Agenda
• TDD
• BDD
• Gherkin
• Cucumber
• Capybara
• Demo (Ruby)
• Conclusions
What is TDD?
• Test-driven
development
(TDD)
o developer writes an
automated test case
o then produces the
minimum code to pass
test
o refactors the code to
acceptable standards
TDD
• Advantages:
o Programmers tend to be
more productive
o Can drive the design of a
program
o Offers the ability to take
small steps
o Can lead to more
modularized, flexible, and
extensible code
• Shortcomings
o Reliance on unit tests might
=> not perform sufficient full
functional testing
o Tests may share the same
blind spots with the code
o Tests become part of the
maintenance overhead of a
project
o Rewrite the tests when
requirements change
What is BDD?
• “BDD builds upon TDD by formalizing the good
habits of the best TDD practitioners.”
- Matt Wynne
• So what are those good habits?
o Working outside-in, starting from a business or organizational goal
o Using examples to clarify requirements
o Developing and using a ubiquitous language
BDD - Gherkin
Story card
Acceptance criteria
User story
As a <role>
I want to <feature>
So that <benefit>
Scenario
Given <initial context>
When <event occurs>
Then <ensure some outcomes>
Example:
Feature: Customer withdraws cash
As a customer,
I want to withdraw cash from an ATM,
So that I don’t have to wait in line at the bank
Scenario: Account is in credit
Given the account is in credit
And the card is valid
And the dispenser contains cash
When the customer requests cash
Then ensure the account is debited
And ensure cash is dispensed
And ensure the card is returned
Scenario: Account is overdrawn past overdraft limit
Given the account is overdrawn
And the card is valid
When the customer requests cash
Then ensure a rejection message is displayed
And ensure cash is not dispensed
And ensure the card is returned
Gherkin exercise
Feature: [ ]
In order to [ ]
As a [ ]
I want to [ ]
Scenario: [ ]
Given [ ]
When [ ]
Then [ ]
What is Gherkin?
The language I use for writing Cucumber features!
What is Cucumber?
• is a tool for running automated acceptance tests
written in a BDD style
• is written in the Ruby programming language
• projects are available for other platforms beyond
Ruby
Cucumber implementation
/features/adding.feature
Feature: Adding
Scenario: Add two numbers
Given the input "2+2“
When the calculator is run
Then the output should be "4"
/step_definitions/calculator_steps.rb
Given /^the input "([^"]*)"$/ do |input|
@input = input
end
When /^the calculator is run$/ do
@output = `ruby calc.rb #{@input}`
raise('Command failed!') unless $?.success?
end
Then /^the output should be "([^"]*)"$/ do |exp_out|
@output.should == exp_out
end
Cucumber testing stack
Capybara
• provides an API for accessing web pages and
interacting with them in a way that is very similar
to how a real user would
• allows you to plug in different web drivers
– including selenium
• it can use real browsers: Firefox, IE or Chrome,
or a number of different browser simulators
Capybara coding
Demo!!!
Create a project from scratch using the tech
stack from this presentation.
Why use Cucumber?
• It is relatively easy to set up.
• It supports multiple report formats, including HTML, JUNIT, PDF.
• It supports writing specifications in about 40 spoken languages
Test scenarios can be read by the stakeholders
• It allows scripting, abstraction and component reuse on several levels
• Although Cucumber is a Ruby tool, it can be used on other languages as .NET or JVM languages.
• It's integrated with all the most popular web testing libraries.
• It allows you to cross reference and index tests using tags, so that you can quickly find all tests
related to a function or run a group of related tests (e.g. quick tests, slow tests, integration tests,
accounting tests).
• It allows you to quickly write and execute a scenario using tabled data
Final Questions
Thank you!
Gabi Kis
Skype: gabikissv
Email: gabi.kis@evozon.com

More Related Content

What's hot

Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkinArati Joshi
 
30 of the best free software test tools in 60 minutes by Jess Lancaster
30 of the best free software test tools in 60 minutes by Jess Lancaster30 of the best free software test tools in 60 minutes by Jess Lancaster
30 of the best free software test tools in 60 minutes by Jess LancasterQA or the Highway
 
B4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriaB4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriab4usolution .
 
Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria An Nguyen
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzQA or the Highway
 
Writing Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaWriting Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaHoa Le
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with CucumberAsheesh Mehdiratta
 
Compare squish tool vs telerik tool
Compare squish tool vs telerik toolCompare squish tool vs telerik tool
Compare squish tool vs telerik toolHoa Le
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...Gareth Bowles
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the cultureShekharRamphal
 
Testing with cucumber testing framework
Testing with cucumber testing frameworkTesting with cucumber testing framework
Testing with cucumber testing frameworkAIMDek Technologies
 
Sustainable Automation Frameworks by Kelsey Shannahan
Sustainable Automation Frameworks by Kelsey ShannahanSustainable Automation Frameworks by Kelsey Shannahan
Sustainable Automation Frameworks by Kelsey ShannahanQA or the Highway
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and WhenPaul Gower
 
Code Camp Applying Modern Software Development Techniques To Ui Testing
Code Camp  Applying Modern Software Development Techniques To Ui TestingCode Camp  Applying Modern Software Development Techniques To Ui Testing
Code Camp Applying Modern Software Development Techniques To Ui TestingChristopherGTaylor
 
Test execution
Test executionTest execution
Test executionadarsh j
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automationShekharRamphal
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalQA or the Highway
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review ProcessDr. Syed Hassan Amin
 

What's hot (20)

Bdd – with cucumber and gherkin
Bdd – with cucumber and gherkinBdd – with cucumber and gherkin
Bdd – with cucumber and gherkin
 
30 of the best free software test tools in 60 minutes by Jess Lancaster
30 of the best free software test tools in 60 minutes by Jess Lancaster30 of the best free software test tools in 60 minutes by Jess Lancaster
30 of the best free software test tools in 60 minutes by Jess Lancaster
 
B4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteriaB4 u solution_writing test cases from user stories and acceptance criteria
B4 u solution_writing test cases from user stories and acceptance criteria
 
Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria Writing test cases from user stories and acceptance criteria
Writing test cases from user stories and acceptance criteria
 
The limits of unit testing by Craig Stuntz
The limits of unit testing by Craig StuntzThe limits of unit testing by Craig Stuntz
The limits of unit testing by Craig Stuntz
 
Writing Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance CriteriaWriting Test Cases From User Stories And Acceptance Criteria
Writing Test Cases From User Stories And Acceptance Criteria
 
Behavior Driven Development with Cucumber
Behavior Driven Development with CucumberBehavior Driven Development with Cucumber
Behavior Driven Development with Cucumber
 
Compare squish tool vs telerik tool
Compare squish tool vs telerik toolCompare squish tool vs telerik tool
Compare squish tool vs telerik tool
 
I Don't Test Often ...
I Don't Test Often ...I Don't Test Often ...
I Don't Test Often ...
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
 
Testing with cucumber testing framework
Testing with cucumber testing frameworkTesting with cucumber testing framework
Testing with cucumber testing framework
 
Sustainable Automation Frameworks by Kelsey Shannahan
Sustainable Automation Frameworks by Kelsey ShannahanSustainable Automation Frameworks by Kelsey Shannahan
Sustainable Automation Frameworks by Kelsey Shannahan
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Code Camp Applying Modern Software Development Techniques To Ui Testing
Code Camp  Applying Modern Software Development Techniques To Ui TestingCode Camp  Applying Modern Software Development Techniques To Ui Testing
Code Camp Applying Modern Software Development Techniques To Ui Testing
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Test execution
Test executionTest execution
Test execution
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automation
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh Dahal
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 

Similar to Behavior Driven Development - TdT@Cluj #15

Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile DeveloperBSGAfrica
 
Встреча "QA: в каких направлениях может найти себя тестировщик?"
Встреча "QA: в каких направлениях может найти себя тестировщик?"Встреча "QA: в каких направлениях может найти себя тестировщик?"
Встреча "QA: в каких направлениях может найти себя тестировщик?"GoIT
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnitsatejsahu
 
Behavioral driven development with Behat
Behavioral driven development with BehatBehavioral driven development with Behat
Behavioral driven development with BehatPromet Source
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware ProgrammingPostSharp Technologies
 
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...SmartBear
 
.NET executable requirements
.NET executable requirements.NET executable requirements
.NET executable requirementsGodfrey Nolan
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDDSarah Dutkiewicz
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven DevelopmentSarah Dutkiewicz
 
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен..."Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...DataArt
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at ScaleOracle Developers
 
Picnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationPicnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationNick Josevski
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven developmentEinar Ingebrigtsen
 

Similar to Behavior Driven Development - TdT@Cluj #15 (20)

Cucumber in Practice(en)
Cucumber in Practice(en)Cucumber in Practice(en)
Cucumber in Practice(en)
 
Bdd in action
Bdd in actionBdd in action
Bdd in action
 
Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile Developer
 
Встреча "QA: в каких направлениях может найти себя тестировщик?"
Встреча "QA: в каких направлениях может найти себя тестировщик?"Встреча "QA: в каких направлениях может найти себя тестировщик?"
Встреча "QA: в каких направлениях может найти себя тестировщик?"
 
Test Driven Development using QUnit
Test Driven Development using QUnitTest Driven Development using QUnit
Test Driven Development using QUnit
 
Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
Behavioral driven development with Behat
Behavioral driven development with BehatBehavioral driven development with Behat
Behavioral driven development with Behat
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
 
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
 
.NET executable requirements
.NET executable requirements.NET executable requirements
.NET executable requirements
 
Introduction to Testing and TDD
Introduction to Testing and TDDIntroduction to Testing and TDD
Introduction to Testing and TDD
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Technical Without Code
Technical Without CodeTechnical Without Code
Technical Without Code
 
Requirements the Last Bottleneck
Requirements the Last BottleneckRequirements the Last Bottleneck
Requirements the Last Bottleneck
 
Introduction to Test Driven Development
Introduction to Test Driven DevelopmentIntroduction to Test Driven Development
Introduction to Test Driven Development
 
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен..."Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...
"Тестирование в Agile в среде виртуализации Vagrant+Docker", Владимир Сидорен...
 
Delivering Developer Tools at Scale
Delivering Developer Tools at ScaleDelivering Developer Tools at Scale
Delivering Developer Tools at Scale
 
Picnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable applicationPicnic Software - Developing a flexible and scalable application
Picnic Software - Developing a flexible and scalable application
 
Driving application development through behavior driven development
Driving application development through behavior driven developmentDriving application development through behavior driven development
Driving application development through behavior driven development
 

More from Tabăra de Testare

Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20Tabăra de Testare
 
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20Tabăra de Testare
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Tabăra de Testare
 
Tap into mobile app testing@TDT Iasi Sept2013
Tap into mobile app testing@TDT Iasi Sept2013Tap into mobile app testing@TDT Iasi Sept2013
Tap into mobile app testing@TDT Iasi Sept2013Tabăra de Testare
 
Test analysis & design good practices@TDT Iasi 17Oct2013
Test analysis & design   good practices@TDT Iasi 17Oct2013Test analysis & design   good practices@TDT Iasi 17Oct2013
Test analysis & design good practices@TDT Iasi 17Oct2013Tabăra de Testare
 
Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Tabăra de Testare
 
TdT@Cluj #14 - Mobile Testing Workshop
TdT@Cluj #14 - Mobile Testing WorkshopTdT@Cluj #14 - Mobile Testing Workshop
TdT@Cluj #14 - Mobile Testing WorkshopTabăra de Testare
 
Test Automation Techniques for Windows Applications
Test Automation Techniques for Windows ApplicationsTest Automation Techniques for Windows Applications
Test Automation Techniques for Windows ApplicationsTabăra de Testare
 
How to bring creativity in testing
How to bring creativity in testingHow to bring creativity in testing
How to bring creativity in testingTabăra de Testare
 
Testarea: Prieten sau dusman? Adrian speteanu
Testarea: Prieten sau dusman? Adrian speteanuTestarea: Prieten sau dusman? Adrian speteanu
Testarea: Prieten sau dusman? Adrian speteanuTabăra de Testare
 

More from Tabăra de Testare (20)

Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
Zed Attack Proxy (ZAP) Quick Intro - TdT@Cluj #20
 
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
 
Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19Robotium framework & Jenkins CI tools - TdT@Cluj #19
Robotium framework & Jenkins CI tools - TdT@Cluj #19
 
Tap into mobile app testing@TDT Iasi Sept2013
Tap into mobile app testing@TDT Iasi Sept2013Tap into mobile app testing@TDT Iasi Sept2013
Tap into mobile app testing@TDT Iasi Sept2013
 
Test analysis & design good practices@TDT Iasi 17Oct2013
Test analysis & design   good practices@TDT Iasi 17Oct2013Test analysis & design   good practices@TDT Iasi 17Oct2013
Test analysis & design good practices@TDT Iasi 17Oct2013
 
Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18
 
Mobile Web UX - TdT@Cluj #17
Mobile Web UX - TdT@Cluj #17Mobile Web UX - TdT@Cluj #17
Mobile Web UX - TdT@Cluj #17
 
TdT@Cluj #14 - Mobile Testing Workshop
TdT@Cluj #14 - Mobile Testing WorkshopTdT@Cluj #14 - Mobile Testing Workshop
TdT@Cluj #14 - Mobile Testing Workshop
 
Security testing
Security testingSecurity testing
Security testing
 
Mobile Testing - TdT Cluj #13
Mobile Testing - TdT Cluj #13Mobile Testing - TdT Cluj #13
Mobile Testing - TdT Cluj #13
 
Td t summary
Td t   summaryTd t   summary
Td t summary
 
How to evaluate a tester
How to evaluate a testerHow to evaluate a tester
How to evaluate a tester
 
Testing, job or game
Testing, job or gameTesting, job or game
Testing, job or game
 
Test Automation Techniques for Windows Applications
Test Automation Techniques for Windows ApplicationsTest Automation Techniques for Windows Applications
Test Automation Techniques for Windows Applications
 
Help them to help you
Help them to help youHelp them to help you
Help them to help you
 
Learning the Agile way
Learning the Agile wayLearning the Agile way
Learning the Agile way
 
How to bring creativity in testing
How to bring creativity in testingHow to bring creativity in testing
How to bring creativity in testing
 
Tester with benefits
Tester with benefitsTester with benefits
Tester with benefits
 
Doing things Differently
Doing things DifferentlyDoing things Differently
Doing things Differently
 
Testarea: Prieten sau dusman? Adrian speteanu
Testarea: Prieten sau dusman? Adrian speteanuTestarea: Prieten sau dusman? Adrian speteanu
Testarea: Prieten sau dusman? Adrian speteanu
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Behavior Driven Development - TdT@Cluj #15

  • 2. Agenda • TDD • BDD • Gherkin • Cucumber • Capybara • Demo (Ruby) • Conclusions
  • 3. What is TDD? • Test-driven development (TDD) o developer writes an automated test case o then produces the minimum code to pass test o refactors the code to acceptable standards
  • 4. TDD • Advantages: o Programmers tend to be more productive o Can drive the design of a program o Offers the ability to take small steps o Can lead to more modularized, flexible, and extensible code • Shortcomings o Reliance on unit tests might => not perform sufficient full functional testing o Tests may share the same blind spots with the code o Tests become part of the maintenance overhead of a project o Rewrite the tests when requirements change
  • 5. What is BDD? • “BDD builds upon TDD by formalizing the good habits of the best TDD practitioners.” - Matt Wynne • So what are those good habits? o Working outside-in, starting from a business or organizational goal o Using examples to clarify requirements o Developing and using a ubiquitous language
  • 6. BDD - Gherkin Story card Acceptance criteria User story As a <role> I want to <feature> So that <benefit> Scenario Given <initial context> When <event occurs> Then <ensure some outcomes> Example: Feature: Customer withdraws cash As a customer, I want to withdraw cash from an ATM, So that I don’t have to wait in line at the bank Scenario: Account is in credit Given the account is in credit And the card is valid And the dispenser contains cash When the customer requests cash Then ensure the account is debited And ensure cash is dispensed And ensure the card is returned Scenario: Account is overdrawn past overdraft limit Given the account is overdrawn And the card is valid When the customer requests cash Then ensure a rejection message is displayed And ensure cash is not dispensed And ensure the card is returned
  • 7. Gherkin exercise Feature: [ ] In order to [ ] As a [ ] I want to [ ] Scenario: [ ] Given [ ] When [ ] Then [ ]
  • 8. What is Gherkin? The language I use for writing Cucumber features!
  • 9. What is Cucumber? • is a tool for running automated acceptance tests written in a BDD style • is written in the Ruby programming language • projects are available for other platforms beyond Ruby
  • 10. Cucumber implementation /features/adding.feature Feature: Adding Scenario: Add two numbers Given the input "2+2“ When the calculator is run Then the output should be "4" /step_definitions/calculator_steps.rb Given /^the input "([^"]*)"$/ do |input| @input = input end When /^the calculator is run$/ do @output = `ruby calc.rb #{@input}` raise('Command failed!') unless $?.success? end Then /^the output should be "([^"]*)"$/ do |exp_out| @output.should == exp_out end
  • 12. Capybara • provides an API for accessing web pages and interacting with them in a way that is very similar to how a real user would • allows you to plug in different web drivers – including selenium • it can use real browsers: Firefox, IE or Chrome, or a number of different browser simulators
  • 14. Demo!!! Create a project from scratch using the tech stack from this presentation.
  • 15. Why use Cucumber? • It is relatively easy to set up. • It supports multiple report formats, including HTML, JUNIT, PDF. • It supports writing specifications in about 40 spoken languages Test scenarios can be read by the stakeholders • It allows scripting, abstraction and component reuse on several levels • Although Cucumber is a Ruby tool, it can be used on other languages as .NET or JVM languages. • It's integrated with all the most popular web testing libraries. • It allows you to cross reference and index tests using tags, so that you can quickly find all tests related to a function or run a group of related tests (e.g. quick tests, slow tests, integration tests, accounting tests). • It allows you to quickly write and execute a scenario using tabled data
  • 17. Thank you! Gabi Kis Skype: gabikissv Email: gabi.kis@evozon.com

Editor's Notes

  1. TDD is a style of programming where you write your tests before you write your code. This helps produce programs that are a bit more error free.
  2. ubiquitous =existingorbeingeverywhere,especiallyatthesametime;omnipresent
  3. Method names are sentences
  4. DSL – Domain Specific Language