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
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Treinamento de testes em JavaScript :: Parte 1
Search
Eduardo Matos
August 22, 2019
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Treinamento de testes em JavaScript :: Parte 1
Eduardo Matos
August 22, 2019
More Decks by Eduardo Matos
See All by Eduardo Matos
Innovation and Leadership: Two sides of the same coin
eduardomatos
0
70
Como se tornar o líder que sua equipe precisa e merece
eduardomatos
0
34
Oito Habilidades do(a) dev indispensável
eduardomatos
2
110
Retrospectivas Eficazes
eduardomatos
0
29
Treinamento de testes em JavaScript :: Parte 4
eduardomatos
2
39
Treinamento de testes em JavaScript :: Parte 3
eduardomatos
0
38
Treinamento de testes em JavaScript :: Parte 2
eduardomatos
0
35
Introdução Ao Kubernetes Para Devs
eduardomatos
0
39
10 Formas De Voltar No Tempo Sem Quebrar As Leis Da Física
eduardomatos
0
54
Other Decks in Technology
See All in Technology
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
4
1k
Bet AI Day 2026丨AIによって本質に戻るシステムリスク管理
layerx
PRO
0
1.3k
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
4
940
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
140
コスト最適化の「めんどくさい」を AWS FinOps Agent でチョット楽にする
classmethod_kaz
0
290
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
420
PfEingのアプローチで働こう
rindrics
0
200
Amazon Quick on DesktopがIAM Identity Centerで動かない理由
yukiogawa
0
130
Bet AI Day 2026丨Agentは、「金融」という巨大産業の何を変えられるのか
layerx
PRO
0
1.2k
AIで仕事のやり方を変える
matsu7874
3
1k
Claude Code本って、 読む必要あるの?
oikon48
1
300
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
120
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
GraphQLとの向き合い方2022年版
quramy
50
15k
Site-Speed That Sticks
csswizardry
13
1.5k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
340
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
Visualization
eitanlees
152
17k
Are puppies a ranking factor?
jonoalderson
2
3.9k
Deep Space Network (abreviated)
tonyrice
0
300
Between Models and Reality
mayunak
4
450
Skip the Path - Find Your Career Trail
mkilby
1
220
Transcript
PASS ./treinamento.test.js Parte 1 ✓ Basics (6ms) Encontros: 1 passed,
4 total Realização: Guilda de Front Apoio: Marcelo Fraga Autor: Eduardo Matos Ran all test suites.
O que são testes automatizados?
Sabe quando você... 1. console.log 2. debugger 3. $ myFunction(a
,b) === 7; 4. browser > click > verify
Você está testando, mas você joga fora todos os testes
depois de ver que o código está ok
Como guardar isso tudo então? R: Automatizando essas verificações, isto
é, escrevendo testes automatizados
Qual a vantagem em relação aos testes manuais? 1. Mais
rápidos (centenas* de testes por minuto) 2. Consistentes (não cometem erros) 3. Abrangentes (sempre roda todos os cenários)
Por que testar? 1. Torna software mais soft 2. Evita
bugs 3. Melhora a qualidade do código 4. Documenta o código
O que testar?
Pirâmide de testes
Troféu de testes
TDD Test Driven Development
None
None
[Intencionalmente deixado em branco]
Iremos criar um parser de URL
Cenário 1 Extrair o protocolo. Ex.: http://this.is.my.site.com/spam https://another.web.site.com/baz ftp://file.sharing.site.com/spam
Cenário 2 Extrair hostname. Ex.: http://localhost http://localhost/ http://site.com/ http://www.stuff.com/spam https://really.long.hostname.dot.com/spam
Cenário 3 Extrair path. Ex.: http://spam/foo http://site.com/foo/ http://site.com/foo/bar https://poxa.vida/hein/wow/
Cenário 4 Extrair querystring. Ex.: http://localhost ({}) http://localhost?foo ({ foo:
“” }) http://site.com/?foo=bar ({ foo: “bar” }) http://www.stuff.com/spam?foo=1&bar=2 ({ foo: “1”, bar: “2” }) https://dot.com/?yay=a&yay=b ({ yay: [“a”, “b”] }) https://que.bo?name=Jo%C3%A3o ({ name: “João”}) https://sai.te?caf%C3%A9=please ({ café: “please”})
Cenário 5 Extrair hash. Ex.: http://localhost (“”) http://localhost#yay http://site.com/#/some/hash http://que.ro?#caf%C3%A9%C3%A9
Cenário 6 Extrair porta. Ex.: http://localhost (80) http://localhost:3000
Cenário 7 Extrair autenticação. Ex.: http://localhost ({user: “”, pass: “”
}) http://user:pass@localhost http://z%C3%A9:man%C3%A9@localhost ({user: “zé”, pass: “mané” })
Cenário 8 Juntando tudo. Ex.: sftp://poxa:
[email protected]
:3000/yay/wow/?spam=egg&spam=r%C3%A3&pat%C3%AA=cream#something