SlideShare uma empresa Scribd logo
1 de 72
Baixar para ler offline
garantia de qualidade
Bdd e TddBdd e Tdd
@danielvlopes
Daniel Lopes
cursos
e-Genial
consultoria | desenvolvimento | UI
area
voltando . . .
Software !
DEADLINE
48 horas
BUGS ZERO
CÓDIGO !
Sou o cara !!!
PESQUISAR
!
Software
Automatização
=
user = User.new
user.do_something
user = User.new
x = user.do_something
puts x
user = User.new
x = user.do_something
if x == "magic"
puts "OK"
else
puts "FAIL"
end
user = User.new
x = user.do_something
if x == "magic"
puts "OK"
else
raise "FAIL"
end
user = User.new
x = user.do_something
unless x == "magic"
raise "FAIL"
end
user = User.new
x = user.do_something
raise "FAIL" unless x == "magic"
def assert(expr)
raise "Fail" unless expr
end
class UserTest < TestUnit
def test_do_something
user = User.new
assert user.do_something == "magic"
end
end
Test::Unit
Automatização ?
Automatização ?
CONFIRMADO
def create(login, password, remember_me, auth_token)
current_user = User.authenticate(login, password)
if current_user.logged_in?
if remember_me
current_user.remember_me!
cookies[:auth_token] = {
:value => current_user.remember_token ,
:expires => current_user.remember_token_expires_at
}
end
redirect_to home_page
else
redirect_to login_page
end
end
def test_create
session = User.new.create(...)
assert ???
end
Teste
Teste
Teste
Código
Teste
Código
Código bonito
Código TESTÁVEL
KENT BECK
Test Driven Dev.
Test Driven Dev.
APROVADO
☺
ClientDetailsValidatorTest
test_fail_with_missing_name
test_fail_with_missing_title
assert ["missing name"], client.errors
☹
Código
Comunicação
=
Trecho do vídeo http://bigthink.com/ideas/21596
def test_fail_with_missing_name
assert_equal "missing name", client.errors.first
end
it should fail without name
client errors should include "missing name"
end
DAN NORTH
Test method como
sentenças
Template simples de sentenças
=
foco
Nomes de testes expressivos
“Behaviour” é mais útil que “test”
David Chelimsky
RSpec
describe Client do
it "should fail without name" do
client.errors.should include("missing name")
end
end
describe Client do
it "should fail without name" do
client.errors.should include("missing name")
end
end
describe Client
it should fail without name
client errors should include “missing name”
Teste como
documentação
Teste como
documentaçãoAPROVADO
Requisitos do software?
Requisitos
Comportamento
=
In order to _______
As _______
I want _______
In order to use the app
As a guest
I want register
Detalhamento
ou
Passos
Given _______
When _______
Then _______
Given I am on signup page
When I fill email with “jonh@gmail.com”
And fill password with “123456”
Then I should see a success message
Aslak Hellesøy
Cucumber
# language: en
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered 10
And I have entered 5
When I press add
Then the result should be 15
Before do
@calc = Calculator.new
end
Given /I have entered (d+)/ do |n|
@calc.push n.to_i
end
When /I press (w+)/ do |op|
@result = @calc.send op
end
Then /the result should be (.*)/ do |result|
@result.should == result.to_f
end
Mas meu projeto é
web ...
Behavior Driven
Development
Behavior Driven
DevelopmentAPROVADO
voltando . . .
CÓDIGO
BUGS
REQUISITOS
DOC’s
☐
☐
☐
☐
CÓDIGO
BUGS
REQUISITOS
DOC’s
☑
☑
☑
☑
DEADLINE
BDD e TDD (Café Ágil)
• Rspec Book - http://bit.ly/3PxKUs
• Kent Beck Vídeos - http://bit.ly/ahiFEX
• Curso de BDD e-Genial - http://bit.ly/a0VqW6
Por onde começo ?
CURSOS
	

 egenial.com.br/cursorails
egenial.com.br/imersaorubyonrails
CONTATOS
	

 twitter @danielvlopes
danielvlopes@gmail.com

Mais conteúdo relacionado

Semelhante a BDD e TDD (Café Ágil)

RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Storiesrahoulb
 
Philipp Von Weitershausen Untested Code Is Broken Code
Philipp Von Weitershausen   Untested Code Is Broken CodePhilipp Von Weitershausen   Untested Code Is Broken Code
Philipp Von Weitershausen Untested Code Is Broken CodeVincenzo Barone
 
Behavior driven development with OPA5 automated tests
Behavior driven development with OPA5 automated testsBehavior driven development with OPA5 automated tests
Behavior driven development with OPA5 automated testsLóránt Guth
 
Tdd for BT E2E test community
Tdd for BT E2E test communityTdd for BT E2E test community
Tdd for BT E2E test communityKerry Buckley
 
Ruby Testing: Cucumber and RSpec
Ruby Testing: Cucumber and RSpecRuby Testing: Cucumber and RSpec
Ruby Testing: Cucumber and RSpecJames Thompson
 
Getting started-with-oracle-so a-viii
Getting started-with-oracle-so a-viiiGetting started-with-oracle-so a-viii
Getting started-with-oracle-so a-viiiAmit Sharma
 
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Aslak Hellesøy
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsSteve Malsam
 
Testing survival Guide
Testing survival GuideTesting survival Guide
Testing survival GuideThilo Utke
 
Step 1- Copy this program into your C++program editor- and compile it-.docx
Step 1- Copy this program into your C++program editor- and compile it-.docxStep 1- Copy this program into your C++program editor- and compile it-.docx
Step 1- Copy this program into your C++program editor- and compile it-.docxChristianBtVNashb
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shineWim Selles
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ LingoIndicThreads
 
Scti 2011 minicurso jquery
Scti 2011 minicurso jqueryScti 2011 minicurso jquery
Scti 2011 minicurso jqueryciberglo
 
What js? Its environment
What js? Its environmentWhat js? Its environment
What js? Its environmentLucio Martinez
 
The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming ProjectSage Jacobs
 
Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич
 Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич
Plugin for Plugin, или расширяем Android New Build System. Антон РуткевичYandex
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018Berend de Boer
 

Semelhante a BDD e TDD (Café Ágil) (20)

RSpec User Stories
RSpec User StoriesRSpec User Stories
RSpec User Stories
 
Philipp Von Weitershausen Untested Code Is Broken Code
Philipp Von Weitershausen   Untested Code Is Broken CodePhilipp Von Weitershausen   Untested Code Is Broken Code
Philipp Von Weitershausen Untested Code Is Broken Code
 
BDD with cucumber
BDD with cucumberBDD with cucumber
BDD with cucumber
 
Behavior driven development with OPA5 automated tests
Behavior driven development with OPA5 automated testsBehavior driven development with OPA5 automated tests
Behavior driven development with OPA5 automated tests
 
Tdd for BT E2E test community
Tdd for BT E2E test communityTdd for BT E2E test community
Tdd for BT E2E test community
 
Ruby Testing: Cucumber and RSpec
Ruby Testing: Cucumber and RSpecRuby Testing: Cucumber and RSpec
Ruby Testing: Cucumber and RSpec
 
JavaScript Operators
JavaScript OperatorsJavaScript Operators
JavaScript Operators
 
Getting started-with-oracle-so a-viii
Getting started-with-oracle-so a-viiiGetting started-with-oracle-so a-viii
Getting started-with-oracle-so a-viii
 
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
Executable Requirements with Behaviour-Driven Development and Cucumber - Euro...
 
I, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot OverlordsI, For One, Welcome Our New Robot Overlords
I, For One, Welcome Our New Robot Overlords
 
Testing survival Guide
Testing survival GuideTesting survival Guide
Testing survival Guide
 
Step 1- Copy this program into your C++program editor- and compile it-.docx
Step 1- Copy this program into your C++program editor- and compile it-.docxStep 1- Copy this program into your C++program editor- and compile it-.docx
Step 1- Copy this program into your C++program editor- and compile it-.docx
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shine
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ Lingo
 
Ticket101
Ticket101Ticket101
Ticket101
 
Scti 2011 minicurso jquery
Scti 2011 minicurso jqueryScti 2011 minicurso jquery
Scti 2011 minicurso jquery
 
What js? Its environment
What js? Its environmentWhat js? Its environment
What js? Its environment
 
The Final Programming Project
The Final Programming ProjectThe Final Programming Project
The Final Programming Project
 
Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич
 Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич
Plugin for Plugin, или расширяем Android New Build System. Антон Руткевич
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 

Mais de Daniel Lopes

Frontline - Rails3.1
Frontline - Rails3.1Frontline - Rails3.1
Frontline - Rails3.1Daniel Lopes
 
Filosofia Ruby e Rails (UFOP e Inforuso 2010)
Filosofia Ruby e Rails (UFOP e Inforuso 2010)Filosofia Ruby e Rails (UFOP e Inforuso 2010)
Filosofia Ruby e Rails (UFOP e Inforuso 2010)Daniel Lopes
 
Steak (Ruby on Rio)
Steak (Ruby on Rio)Steak (Ruby on Rio)
Steak (Ruby on Rio)Daniel Lopes
 
Adobe Air e HTML (FlexForKids)
Adobe Air e HTML (FlexForKids)Adobe Air e HTML (FlexForKids)
Adobe Air e HTML (FlexForKids)Daniel Lopes
 
Steak (Oxente Rails)
Steak (Oxente Rails)Steak (Oxente Rails)
Steak (Oxente Rails)Daniel Lopes
 
Mercado (Pós UNA)
Mercado (Pós UNA)Mercado (Pós UNA)
Mercado (Pós UNA)Daniel Lopes
 
Frontend (RailsMG)
Frontend (RailsMG)Frontend (RailsMG)
Frontend (RailsMG)Daniel Lopes
 
Introdução ao Rails (Linguagil)
Introdução ao Rails (Linguagil)Introdução ao Rails (Linguagil)
Introdução ao Rails (Linguagil)Daniel Lopes
 
Ruby on Rails - uma mentalidade (Café com Tom)
Ruby on Rails - uma mentalidade (Café com Tom)Ruby on Rails - uma mentalidade (Café com Tom)
Ruby on Rails - uma mentalidade (Café com Tom)Daniel Lopes
 
Frontend (Rails For Kids)
Frontend (Rails For Kids)Frontend (Rails For Kids)
Frontend (Rails For Kids)Daniel Lopes
 

Mais de Daniel Lopes (10)

Frontline - Rails3.1
Frontline - Rails3.1Frontline - Rails3.1
Frontline - Rails3.1
 
Filosofia Ruby e Rails (UFOP e Inforuso 2010)
Filosofia Ruby e Rails (UFOP e Inforuso 2010)Filosofia Ruby e Rails (UFOP e Inforuso 2010)
Filosofia Ruby e Rails (UFOP e Inforuso 2010)
 
Steak (Ruby on Rio)
Steak (Ruby on Rio)Steak (Ruby on Rio)
Steak (Ruby on Rio)
 
Adobe Air e HTML (FlexForKids)
Adobe Air e HTML (FlexForKids)Adobe Air e HTML (FlexForKids)
Adobe Air e HTML (FlexForKids)
 
Steak (Oxente Rails)
Steak (Oxente Rails)Steak (Oxente Rails)
Steak (Oxente Rails)
 
Mercado (Pós UNA)
Mercado (Pós UNA)Mercado (Pós UNA)
Mercado (Pós UNA)
 
Frontend (RailsMG)
Frontend (RailsMG)Frontend (RailsMG)
Frontend (RailsMG)
 
Introdução ao Rails (Linguagil)
Introdução ao Rails (Linguagil)Introdução ao Rails (Linguagil)
Introdução ao Rails (Linguagil)
 
Ruby on Rails - uma mentalidade (Café com Tom)
Ruby on Rails - uma mentalidade (Café com Tom)Ruby on Rails - uma mentalidade (Café com Tom)
Ruby on Rails - uma mentalidade (Café com Tom)
 
Frontend (Rails For Kids)
Frontend (Rails For Kids)Frontend (Rails For Kids)
Frontend (Rails For Kids)
 

Último

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding TeamAdam Moalla
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 

Último (20)

Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 

BDD e TDD (Café Ágil)