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
• 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
 
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
 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010singingfish
 

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
 
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
 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
 

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

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

BDD e TDD (Café Ágil)