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
TDC 2016 Floripa - Testando APIs REST com Super...
Search
Stefan Teixeira
May 12, 2016
Programming
35
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDC 2016 Floripa - Testando APIs REST com Supertest e Promises
Palestra apresentada na trilha JavaScript do TDC 2016 Florianópolis, no dia 12 de Maio
Stefan Teixeira
May 12, 2016
More Decks by Stefan Teixeira
See All by Stefan Teixeira
Scrum Gathering Portugal 2016 - Containerizing Tests with Docker
stefanteixeira
0
93
Agile Brazil 2016 - 5 fundamentos essenciais de padrões xUnit
stefanteixeira
0
120
Latinoware 2016 - Continuous Delivery com ferramentas open source
stefanteixeira
0
78
Ágiles 2016 - Using open source tools to support Continuous Delivery
stefanteixeira
0
66
6º Encontro do Grupo de Testes Carioca - Testes em um contexto de Continuous Delivery
stefanteixeira
0
52
TDC 2016 SP - Desmistificando cobertura de código como métrica de qualidade
stefanteixeira
0
140
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-source
stefanteixeira
0
97
TDC 2016 SP - Cobertura de código de procedures T-SQL com SQLCC
stefanteixeira
0
82
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
stefanteixeira
0
74
Other Decks in Programming
See All in Programming
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
260
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
160
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
600
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
150
速習iPhone Duo対応
yuukiw00w
2
930
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
270
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
20k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Intent as Code
shoppingjaws
6
1.1k
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
570
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
mrbgem 三角測量 開発
ogom
0
170
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
From π to Pie charts
rasagy
1
380
Large-scale JavaScript Application Architecture
addyosmani
515
110k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
390
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
540
Exploring anti-patterns in Rails
aemeredith
4
520
A Soul's Torment
seathinner
8
3.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Rails Girls Zürich Keynote
gr2m
96
14k
Transcript
Globalcode – Open4education Testando APIs REST com Supertest e Promises
Stefan Teixeira
[email protected]
/ stefanteixeira.com.br
• QA Automation Engineer • Entusiasta de Automação de Testes,
Agile Testing e DevOps • Blogs técnicos: stefanteixeira.com.br (pt-br) / stefanteixeira.com (en) Contatos: • E-mail:
[email protected]
• Twitter: twitter.com/stefan_teixeira • LinkedIn: linkedin.com/in/stefanteixeira • GitHub: github.com/stefanteixeira • SlideShare: slideshare.net/stefanteixeira Sobre
Vocês testam suas APIs REST?
Testando APIs REST
Qual lib usar?
Qual lib usar?
Qual lib usar?
Supertest • Criado pelo TJ Holowaychuk https://www.npmjs.com/package/supertest | https://github.com/visionmedia/supertest
Supertest • Criado pelo TJ Holowaychuk • MUITO simples https://www.npmjs.com/package/supertest
| https://github.com/visionmedia/supertest
Supertest • Criado pelo TJ Holowaychuk • MUITO simples •
Independente de runner (Jasmine, Mocha, etc) https://www.npmjs.com/package/supertest | https://github.com/visionmedia/supertest
Exemplos
GET
POST
E com testes mais complexos?
Callback Hell
Promises!
supertest-as-promised https://www.npmjs.com/package/supertest-as-promised https://github.com/WhoopInc/supertest-as-promised
E o teste com Promises?
Projeto de exemplo https://github.com/stefanteixeira/demo-supertest
Globalcode – Open4education Stefan Teixeira @stefan_teixeira
[email protected]
stefanteixeira.com.br stefanteixeira.com Obrigado!