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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
アリアドネの糸と、20年ごとの建て替え ── 長尾真『電子図書館』を、伊勢で読み直す / Rereading Makoto Nagao’s "Electronic Library" in Ise
ykiyota
0
120
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
270
Bet AI Day 2026丨Agentは、「金融」という巨大産業の何を変えられるのか
layerx
PRO
0
1.2k
AI時代だからこそ、スケールしないことをやろう
yutashigemura
1
120
AI 駆動 Terraform 開発/SRE_BizReach_MIXI_2
visional_engineering_and_design
3
2k
Claude Code本って、 読む必要あるの?
oikon48
1
300
20260912_スクラムにジェネラリストは必要か
ryugen04
0
170
Podは生きているのにGoだけが落ちる:GOGCとGOMEMLIMITで追うInvisible OOM Killの謎
tkc66buzz
1
230
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
2
390
現場に行くだけでは足りない——プロダクトエンジニアが業務の流れを捉える観点と、その鍛え方
takumiengineering
0
360
Bet AI Day 2026丨AIを「使う」から、AIが「働く」へ ― LayerXが進める「組織AI」の社会実装
layerx
PRO
3
2.9k
PfEingのアプローチで働こう
rindrics
0
200
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
How STYLIGHT went responsive
nonsquared
100
6.3k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
510
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
New Earth Scene 8
popppiees
3
2.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
260
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Color Theory Basics | Prateek | Gurzu
gurzu
0
460
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
430
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