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 - Testing REST APIs with Super...
Search
Stefan Teixeira
May 12, 2016
Programming
53
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDC 2016 Floripa - Testing REST APIs with Supertest and Promises
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
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
20k
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
320
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
430
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
520
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.3k
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
570
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
290
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
270
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
110
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
290
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
5.8k
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.5k
Practical Orchestrator
shlominoach
192
12k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
710
The Limits of Empathy - UXLibs8
cassininazir
1
690
Build your cross-platform service in a week with App Engine
jlugia
234
19k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The Language of Interfaces
destraynor
162
27k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
590
Faster Mobile Websites
deanohume
310
32k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
Transcript
Globalcode – Open4education Testing REST APIs with Supertest and Promises
Stefan Teixeira
[email protected]
/ @stefan_teixeira
• QA Automation Engineer • Test Automation, Agile and DevOps
enthusiast • Technical blogs: stefanteixeira.com.br (pt-br) / stefanteixeira.com (en) Links: • E-mail:
[email protected]
• Twitter: twitter.com/stefan_teixeira • LinkedIn: linkedin.com/in/stefanteixeira • GitHub: github.com/stefanteixeira • SlideShare: slideshare.net/stefanteixeira About me
Do you test your REST APIs?
Testing REST APIs
Which library should I use?
Which library should I use?
Which library should I use?
Supertest • Created by TJ Holowaychuk https://www.npmjs.com/package/supertest | https://github.com/visionmedia/supertest
Supertest • Created by TJ Holowaychuk • REALLY simple https://www.npmjs.com/package/supertest
| https://github.com/visionmedia/supertest
Supertest • Created by TJ Holowaychuk • REALLY simple •
Runner-independent (you can use Jasmine, Mocha, etc) https://www.npmjs.com/package/supertest | https://github.com/visionmedia/supertest
Examples
GET
POST
What about complex tests?
Callback Hell
Promises!
supertest-as-promised https://www.npmjs.com/package/supertest-as-promised https://github.com/WhoopInc/supertest-as-promised
Complex test with Promises
Sample project https://github.com/stefanteixeira/demo-supertest
Globalcode – Open4education Stefan Teixeira @stefan_teixeira
[email protected]
stefanteixeira.com.br stefanteixeira.com Thanks!