Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Falando sobre testes automatizados
Search
Breno Oliveira
October 17, 2014
Technology
100
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
67
Como Fazer Minha Gem e o Rails Conversarem Bem
brenooliveira
0
59
Javascript Pitfalls
brenooliveira
0
99
Elasticsearch - Turbinando sua aplicação PHP
brenooliveira
1
160
Elasticsearch
brenooliveira
1
130
Other Decks in Technology
See All in Technology
事業成長とデータ活用を止めないためのマネジメントへ挑戦
hiracky16
0
300
メルペイ 会計システム概要と歴史
mewuto
1
210
Loop Engineering, beyond prompt, context, and harness engineering
glaforge
0
100
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
200
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
320
DGX Spark でどこまでハッキングができるのか?
kash1064
0
950
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
120
USB PDを使ってスマホを労わりたい
raspython3
0
160
ビジネスを止めない技術的負債の返済のための戦略とその手法 - 技術的負債と向き合う / Complexity and Simplicity
soudai
PRO
3
700
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
360
会社説明資料
persolserverworks
0
9.7k
AI時代のPRレビューにどう向き合うか?
kairim0
1
210
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
529
40k
Scaling GitHub
holman
464
140k
Building Applications with DynamoDB
mza
96
7.2k
Marketing to machines
jonoalderson
1
5.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
A designer walks into a library…
pauljervisheath
211
25k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
600
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Speed Design
sergeychernyshev
33
2.2k
Documentation Writing (for coders)
carmenintech
77
5.6k
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