Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Falando sobre testes automatizados
Search
Breno Oliveira
October 17, 2014
Technology
94
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Falando sobre testes automatizados
Vamos falar um pouco mais sobre testes automatizados
Breno Oliveira
October 17, 2014
More Decks by Breno Oliveira
See All by Breno Oliveira
Spring e Eureka Service Discovery
brenooliveira
0
64
Como Fazer Minha Gem e o Rails Conversarem Bem
brenooliveira
0
53
Javascript Pitfalls
brenooliveira
0
97
Elasticsearch - Turbinando sua aplicação PHP
brenooliveira
1
160
Elasticsearch
brenooliveira
1
120
Other Decks in Technology
See All in Technology
AIツールを導入しても生産性はあがらない? カオナビが直面した 3つの壁と乗り越え方。/ Overcoming 3 Barriers to AI-Driven Productivity at kaonavi
kaonavi
0
200
2年前に削除したPHPクラスが、 ある日突然決済をエラーにした
ykagano
1
800
Amplify Gen2でbackend.tsにCDKを定義する/しない事によるCDKの挙動の違いとユースケース
smt7174
1
490
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
170
AI時代におけるエンジニアの新たな役割──FDEとクオリアの探求/登壇資料(戸井田 裕貴)
hacobu
PRO
0
330
reFACToring
moznion
0
200
生成 AI 時代にいま一度「問い合わせ」について考えてみる
kazzpapa3
1
130
人とエージェントが高め合う協業設計
kintotechdev
0
760
生成AI×AWS CDK×AWS FISで"振り返れる"ミニGameDayをつくろう
yoshimi0227
2
530
OPENLOGI Company Profile for engineer
hr01
1
75k
Power Automateアップデート情報
miyakemito
0
110
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
510
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
Into the Great Unknown - MozCon
thekraken
41
2.6k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
190
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
380
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
370
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
How to Talk to Developers About Accessibility
jct
2
430
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
380
It's Worth the Effort
3n
188
29k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
220
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
260
Transcript
Falando de Testes Breno Oliveira
“Testar pra que? O que eu fiz vai funcionar …"
–dummy programmer
Quem garante QUE vai funcionar?
por isso testamos murphy's law
–William Edwards Deming “In God we Trust, all others bring
data”
Não se desespere os testes estão ai para te ajudar
Testes lhe dão a confiança para a mudança
Descrevem o comportamento do software
Facilita a Adição de melhorias
Tempo de desenvolvimento
Ajudam a reduzir o número de bugs
E principalmente …
Ninguém vai te olhar com essa cara ao ver um
código seu …
Quanto devemos testar?
–Uncle Bob 1 of Kent’s older wise sayings was: “Test
everything that could possibly break.” I think that’s a pretty good recipe.
keep it simple and stupid
Baby steps ftw
Testes Unitários Teste de funções do código independente de outras
partes do sistemas
Muitas vezes escrevemos testes de unidade Que não testam nada
Testar constante é importante Mas talvez não com teste de
unidade Escreva um teste de integração
{ Então o que poderíamos testar daquele código? }
Verifique ao passar o valor 4111 foi gerado foi um
pagamento com VISA.
Teste de Integração Testa a integração entre as funções e
objetos do sistema
garantem que suas classes comunicam-se com APIs, escrevem arquivos texto
ou mesmo gravar no banco são considerados testes de integração.
Lembre-se
Você não trabalha sozinho
TDD BDD NO TESTS ATDD ?
O que fazer então?
TDD
–Kent Beck “Desenvolvimento guiados por testes é uma forma de
administrar o medo durante a programação!”
None
None
Baby steps ftw Novamente
ERROR test_should_initialize_a_post (0:00:00.000) uninitialized constant PostTest::Post
PASS test_should_initialize_a_post
Vamos lá Eu sei que você pode fazer mais Mais
confiança cara
ERROR test_should_have_a_title_if_is_setted undefined method `title' for #<Post:0x0000010091dc90>
PASS test_should_have_a_title_if_is_setted
ERROR test_should_have_a_title_if_is_setted undefined method `title=' for #<Post:0x0000010107ca90>
PASS test_should_have_a_title_if_is_setted
FAIL test_should_have_a_blank_title_if_none_is_setted Expected: nil Actual: "my post”
PASS test_should_have_a_blank_title_if_none_is_setted
None
PASS test_should_have_a_blank_title_if_none_is_setted PASS test_should_initialize_a_post PASS test_should_have_a_title_if_is_setted
Ok … Meio idiota o exemplo Mas não temos tempo
:(
BDD
Desenvolvimento orientado ao comportamento
testar o comportamento da sua aplicação
mais sobre escrever especificações
escrever testes também é documentar
None
None
None