SlideShare a Scribd company logo
TEST DRIVEN DEVELOPMENT
Hercules Lemke Merscher - @hlmerscher
O que é?
http://i-love-my-life.com/wp-content/uploads/2011/03/doubt.jpg
TÉCNICA
https://media.licdn.com/mpr/mpr/shrinknp_800_800/AAEAAQAAAAAAAASQAAAAJDllYzc1ZjgxLTliNDQtNGU2MS1hNDg0LTFiOWZlNTQ4N2Q5ZA.png
TDD E TESTE AUTOMATIZADO. SINÔNIMOS?
https://images.rapgenius.com/e7c0c514d4e7564079c2e6b0c8d547b5.540x350x1.jpg
POR QUÊ?
https://imgflip.com/s/meme/Question-Rage-Face.jpg
ERROS RECORRENTES
https://upload.wikimedia.org/wikipedia/commons/3/3b/Windows_9X_BSOD.png
O COMPUTADOR É MAIS RÁPIDO http://www.seuseriado.com/wp-content/uploads/2016/04/The-Flash-2ª-Temporada.jpg
O COMPUTADOR NÃO CANSA
http://2.bp.blogspot.com/-mF5paUPo6tQ/UkeaGETMkWI/AAAAAAAAAYA/L6AnHHKP8uc/s1600/52636309+(1).png
LEI DE MURPHY
http://shedka.com/wp-content/uploads/2015/06/tostada-1000x666.jpg
BUG’S EM PRODUÇÃO
http://www.dan-dare.org/FreeFun/Images/CartoonsMoviesTV/BugsLifeWallpaper800.jpg
MEDO DE TOCAR NO CÓDIGO
https://councillorpadraigmcshane.files.wordpress.com/2012/11/scooby-and-shaggy-afraid-scooby-doo-2992126-852-480.jpg
CORREÇÕES QUE GERAM MAIS BUG’S
http://web.pdx.edu/~cem3/looney/img/coyoterocket.png
http://iblasquez.github.io/presentation_TDD_CodingDojo/TDD_Mantra.png
VERMELHO
http://static.maciverinstitute.com/F%20Letter%20Grade-cropped-proto-custom_4-thumb-618xauto-7419.jpg
VERDE
https://www.exceptionnotfound.net/content/images/2015/04/the-coder.jpg
REFATORA
http://cdn.hitfix.com/photos/6214402/HannibalLecterSOTL.jpg
E A PARTE DO CÓDIGO, JÁ CHEGOU?
https://i.ytimg.com/vi/ovm2zkuqJD8/maxresdefault.jpg
PRIMEEEIIIIROOOO...
ESCREVA O TESTE
http://2.bp.blogspot.com/-S8U-dF2WTzk/UlLk0q5jy4I/AAAAAAAAC4M/OFlBxMqwCYA/s1600/mask.jpg
TESTE
test('Product instantiates a new product', (t) => {
let product = new Product();
t.ok(product instanceof Product);
t.end();
});
TESTE FALHA
ReferenceError: Product is not defined
CÓDIGO
function Product() {
}
TESTE PASSA
# Product instantiates a new product
ok 1 should be truthy
1..1
# tests 1
# pass 1
# ok
BABY STEPS
http://www.clipartkid.com/images/300/download-baby-steps-clipart-LA7TaY-
clipart.jpg
TESTE
test('Product#price zero by default', (t) => {
let product = new Product();
t.equal(product.price, 0);
t.end();
});
TESTE FALHA
# Product#price zero by default
not ok 2 should be equal
---
operator: equal
expected: 0
actual: undefined
CÓDIGO
function Product() {
this.price = 0;
}
TESTE PASSA
# Product#price zero by default
ok 2 should be equal
1..2
# tests 2
# pass 2
# ok
TESTE
test('Product#quantity zero by default', (t) => {
let product = new Product();
t.equal(product.quantity, 0);
t.end();
});
TESTE FALHA
# Product#quantity zero by default
not ok 3 should be equal
---
operator: equal
expected: 0
actual: undefined
CÓDIGO
function Product() {
this.price = 0;
this.quantity = 0;
}
TESTE PASSA
# Product#quantity zero by default
ok 3 should be equal
1..3
# tests 3
# pass 3
# ok
TESTE
test('Product#total calculates amount', (t) => {
let product = Object.assign(
new Product(), { price: 10, quantity: 2 });
t.equal(product.total(), 20);
t.end();
});
TESTE FALHA
t.equal(product.total(), 20);
^
TypeError: product.total is not a function
CÓDIGO
function Product() {
this.price = 0;
this.quantity = 0;
this.total = () => this.price * this.quantity;
}
TESTE PASSA
# Product#total calculates amount
ok 4 should be equal
1..4
# tests 4
# pass 4
# ok
COM TDD EU AGARANTCHÍU !!!
https://img.buzzfeed.com/buzzfeed-static/static/2015-03/3/10/enhanced/webdr14/enhanced-buzz-29154-1425395469-14.jpg
TDD É SOBRE FEEDBACK
http://www.sacadasdecarreira.com.br/files/2015/12/design-feedback-tips.png
TESTE UNITÁRIO
http://unity-coding.slashgames.org/wp-content/uploads/unit-test.jpg
TESTE DE REGRESSÃO
https://d.ibtimes.co.uk/en/full/1396036/delorean.jp
TESTE DE INTEGRAÇÃO
http://mlb-s1-p.mlstatic.com/15139-MLB20096270752_052014-O.jpg
TESTE DE ACEITAÇÃO
http://aaronacceptance.ca/wp-content/uploads/2015/07/Loan-Approval_Aaron_Acceptance_256.png
MOCKS, STUBS E FAKES
http://goias24horas.com.br/wp-content/uploads/2013/08/marionete.jpg
CÓDIGO DIFÍCIL
DE TESTAR
É UM MAU SINAL?
QUANTAS
ASSERTIVAS
POR TESTE?
DEVO USAR
PASSOS DE BEBÊ
SEMPRE?
PRECISO
DA APROVAÇÃO DO MEU
CHEFE PARA
ESCREVER TESTES?
http://cdn.business2community.com/wp-content/uploads/2016/01/Godfather-300x169-3.png-3.png
COBERTURA
COBERTURA
https://github.com/hlmerscher/dojo-onde
http://www.maonamassasalgadosecia.com.br/uploads/widget/image/512/170/51217096/mao-na-massa.png
REFERÊNCIAS
OBRIGADO!
www.herculesdev.com.br

More Related Content

PDF
The Less Hacked Path
PPTX
Agile & lean
PDF
4.4 Final PPP Slideshow by: Philip Scaringi
PPT
Why, When and How? Considering ePortfolios
PDF
Klein_Andrew_PPP_Presentation
PPTX
Tactics for Implementing Test Automation for Legacy Code
PDF
Visual Management: Leading With What You Can See
PDF
Mind the Gap: Realising the Value of Agility
The Less Hacked Path
Agile & lean
4.4 Final PPP Slideshow by: Philip Scaringi
Why, When and How? Considering ePortfolios
Klein_Andrew_PPP_Presentation
Tactics for Implementing Test Automation for Legacy Code
Visual Management: Leading With What You Can See
Mind the Gap: Realising the Value of Agility

What's hot (20)

PDF
Coaching Nightmares: Lessons We Can Learn From Gordon Ramsay
PPTX
Anatomy of a web page
PPTX
Souders WPO Web2.0Expo
PDF
FailAgility: Recognising and Resetting the Agile Boundaries
PDF
How to spot the dinosaur managers at work
PDF
Metrics of Joy
PDF
Making Data Useful
PDF
Mind the Gap: Realising the Value of Agility
PPTX
Curley_Bryce_DMP2
PDF
Visual Management: Leading With What You Can See
PDF
CloudCamp London 8 Mar 2018 - Douglas Adams
PDF
Real World Technology -- AASL Preconference, ALA Annual 2013
PPTX
One Trick 2 0 Tools Tds March 2011a
PDF
Play framework 2.0 Introduction
PDF
7 Deadly Sins of Agile Software Test Automation
PDF
Benjamin medina Slideshow
PPTX
High Performance HTML5 (SF HTML5 UG)
PPTX
Creating e learning mashups
PPTX
High Performance Mobile (SF/SV Web Perf)
PPTX
Utter failures and lessons remained unlearned
Coaching Nightmares: Lessons We Can Learn From Gordon Ramsay
Anatomy of a web page
Souders WPO Web2.0Expo
FailAgility: Recognising and Resetting the Agile Boundaries
How to spot the dinosaur managers at work
Metrics of Joy
Making Data Useful
Mind the Gap: Realising the Value of Agility
Curley_Bryce_DMP2
Visual Management: Leading With What You Can See
CloudCamp London 8 Mar 2018 - Douglas Adams
Real World Technology -- AASL Preconference, ALA Annual 2013
One Trick 2 0 Tools Tds March 2011a
Play framework 2.0 Introduction
7 Deadly Sins of Agile Software Test Automation
Benjamin medina Slideshow
High Performance HTML5 (SF HTML5 UG)
Creating e learning mashups
High Performance Mobile (SF/SV Web Perf)
Utter failures and lessons remained unlearned
Ad

Similar to Test Driven Development (20)

PPTX
Logan composition (2)
PDF
Testing Like a Pro - Chef Infrastructure Testing
PPTX
CV writing
PDF
Mborell newsilent week6
PPTX
Owasp hyd 28_dec2013_opensamm
PPTX
NULL - OpenSAMM
PPT
Wind Pad 100w NUI interface PK
PPTX
Social Media Confusion? How to Choose the Right Network
PDF
[IGC 2017] 잔디소프트 윤세민 - HTML5, 크로스플랫폼, 그리고 MMORPG feat. 매드월드
PPTX
Empowering DevOps with Cloud Foundry
PPTX
関於鋼琴
PPT
Computer
PDF
Speed is Essential for a Great Web Experience
PPTX
Differentiated structures
PDF
Apache Hadoop Ecosystem (based on an exemplary data-driven…
PPTX
Presentacion de percy keyro mancilla pinedo
PDF
Here is a Backlinks Of Softpcfree.com.pdf
PDF
Agile Coaching Nightmares: Lessons We Can Learn From Gordon Ramsay
PPTX
REST for .NET - Introduction to ASP.NET Web API
KEY
Command keynote! part 2p2p2
Logan composition (2)
Testing Like a Pro - Chef Infrastructure Testing
CV writing
Mborell newsilent week6
Owasp hyd 28_dec2013_opensamm
NULL - OpenSAMM
Wind Pad 100w NUI interface PK
Social Media Confusion? How to Choose the Right Network
[IGC 2017] 잔디소프트 윤세민 - HTML5, 크로스플랫폼, 그리고 MMORPG feat. 매드월드
Empowering DevOps with Cloud Foundry
関於鋼琴
Computer
Speed is Essential for a Great Web Experience
Differentiated structures
Apache Hadoop Ecosystem (based on an exemplary data-driven…
Presentacion de percy keyro mancilla pinedo
Here is a Backlinks Of Softpcfree.com.pdf
Agile Coaching Nightmares: Lessons We Can Learn From Gordon Ramsay
REST for .NET - Introduction to ASP.NET Web API
Command keynote! part 2p2p2
Ad

Recently uploaded (20)

PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Cost to Outsource Software Development in 2025
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
iTop VPN Crack Latest Version Full Key 2025
Design an Analysis of Algorithms I-SECS-1021-03
Operating system designcfffgfgggggggvggggggggg
Wondershare Filmora 15 Crack With Activation Key [2025
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Digital Systems & Binary Numbers (comprehensive )
Advanced SystemCare Ultimate Crack + Portable (2025)
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Designing Intelligence for the Shop Floor.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Reimagine Home Health with the Power of Agentic AI​
wealthsignaloriginal-com-DS-text-... (1).pdf
Cost to Outsource Software Development in 2025
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
iTop VPN Crack Latest Version Full Key 2025

Test Driven Development

Editor's Notes

  • #4: TDD é uma técnica onde testes automatizados são utilizados como ferramenta durante o desenvolvimento.
  • #9: sexta-feira, 17:50h, depois de fazer aquela lógica mega complexa, e tem de testar manualmente com várias permutações de valores
  • #42: Cenário, ação e validação.
  • #44: Um teste com muitas assertivas pode estar apontando um objeto/método que talvez precise ser dividido.
  • #45: Um teste com muitas assertivas pode estar apontando um objeto/método que talvez precise ser dividido.
  • #46: Um teste com muitas assertivas pode estar apontando um objeto/método que talvez precise ser dividido.