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
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
30
Treinamento de testes em JavaScript :: Parte 4
eduardomatos
2
40
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
55
Other Decks in Technology
See All in Technology
時うどん〜Socket.getifaddrsで学ぶネットワーク編 / Tokiudon: The Socket.getifaddrs Edition
coe401_
4
240
2026-09-08 そのJavaモダナイゼーション、AIに丸投げで大丈夫?IBM Bobで変わる品質と効率
yutanonaka
1
160
JSONataとAWS Step Functionsで目指すRuntimelessな世界
mu7889yoon
0
460
beyond jj: config & tools ecosystem
indirect
0
5.9k
Making AI Agents Safe and Fast- Jev, Obsidian, and the Meta-Harness
x5gtrn
PRO
0
130
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
160
「どのログを見ればいい?」 から始めた サーバーレス障害解析
y_waka1
1
140
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
1
270
手を動かして実感する、Kiro が変える開発体験
inariku
0
220
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
130
AIに賢く動いてもらうためのコンテキスト〜Snowflake女子会 vol.8
snowwmn0824
0
170
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
cscengineer
PRO
0
310
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
500
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
260
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
470
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
550
Become a Pro
speakerdeck
PRO
31
6.3k
Mind Mapping
helmedeiros
1
370
Producing Creativity
orderedlist
PRO
348
41k
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