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
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
69
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
28
Treinamento de testes em JavaScript :: Parte 4
eduardomatos
2
38
Treinamento de testes em JavaScript :: Parte 3
eduardomatos
0
38
Treinamento de testes em JavaScript :: Parte 2
eduardomatos
0
32
Introdução Ao Kubernetes Para Devs
eduardomatos
0
39
10 Formas De Voltar No Tempo Sem Quebrar As Leis Da Física
eduardomatos
0
51
Other Decks in Technology
See All in Technology
AIソロプレナー時代に2ヶ月で20人増員した事業創造会社の開発組織の話
miyatakoji
0
660
"何を作るか"を任される エンジニアは、どう育つのか
yutaokafuji
1
680
「エンジニア進化論」2028年の開発完全自動化、エンジニアはどう進化するか
cyberagentdevelopers
PRO
6
5.1k
SONiCで構築・運用する生成AI向けパブリッククラウドネットワーク ~実装編~
sonic
0
210
攻撃者視点で考えるDetection Engineering
cryptopeg
3
1.8k
SONiCの統計情報を取得したい
sonic
0
160
機械学習を「社会実装」するということ 2026年夏版 / Social Implementation of Machine Learning June 2026 Version
moepy_stats
5
2.4k
On-behalf-of Token exchange with AgentCore Identity
hironobuiga
2
200
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
1.1k
Bedrock AgentCore RuntimeでAuth0 Changelog調査AIをアップグレードした話
t5u8a5a
1
140
【Cyber-sec+】経営層を"動かす"ための考え方
hssh2_bin
0
180
日本 Fintech 未来予測レポート 2027〜2028年(手動編集版)
8maki
0
2.3k
Featured
See All Featured
Claude Code のすすめ
schroneko
67
230k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
350
Ethics towards AI in product and experience design
skipperchong
2
310
The Cult of Friendly URLs
andyhume
79
6.9k
GraphQLとの向き合い方2022年版
quramy
50
15k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
Utilizing Notion as your number one productivity tool
mfonobong
4
320
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
840
Google's AI Overviews - The New Search
badams
0
1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Design in an AI World
tapps
1
240
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