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
0
87
Falando sobre testes automatizados
Vamos falar um pouco mais sobre testes automatizados
Breno Oliveira
October 17, 2014
Tweet
Share
More Decks by Breno Oliveira
See All by Breno Oliveira
Spring e Eureka Service Discovery
brenooliveira
0
57
Como Fazer Minha Gem e o Rails Conversarem Bem
brenooliveira
0
45
Javascript Pitfalls
brenooliveira
0
87
Elasticsearch - Turbinando sua aplicação PHP
brenooliveira
1
150
Elasticsearch
brenooliveira
1
120
Other Decks in Technology
See All in Technology
TypeScript入門
recruitengineers
PRO
35
11k
実運用で考える PGO
kworkdev
PRO
0
130
Webブラウザ向け動画配信プレイヤーの 大規模リプレイスから得た知見と学び
yud0uhu
0
180
iPhone Eye Tracking機能から学ぶやさしいアクセシビリティ
fujiyamaorange
0
300
ヘブンバーンズレッドにおける、世界観を活かしたミニゲーム企画の作り方
gree_tech
PRO
0
440
モダンフロントエンド 開発研修
recruitengineers
PRO
10
6.2k
5年目から始める Vue3 サイト改善 #frontendo
tacck
PRO
2
130
データアナリストからアナリティクスエンジニアになった話
hiyokko_data
2
340
モバイルアプリ研修
recruitengineers
PRO
5
1.7k
allow_retry と Arel.sql / allow_retry and Arel.sql
euglena1215
1
150
AI時代にPdMとPMMはどう連携すべきか / PdM–PMM-collaboration-in-AI-era
rakus_dev
0
260
DuckDB-Wasmを使って ブラウザ上でRDBMSを動かす
hacusk
1
140
Featured
See All Featured
Balancing Empowerment & Direction
lara
3
610
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Making Projects Easy
brettharned
117
6.4k
Being A Developer After 40
akosma
90
590k
For a Future-Friendly Web
brad_frost
179
9.9k
Building an army of robots
kneath
306
46k
Music & Morning Musume
bryan
46
6.8k
A Tale of Four Properties
chriscoyier
160
23k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
GraphQLとの向き合い方2022年版
quramy
49
14k
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