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
56
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
Transcript
20 slides
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!
More Decks by Stefan Teixeira
See All by Stefan Teixeira
Scrum Gathering Portugal 2016 - Containerizing Tests with Docker
stefanteixeira
0
95
Agile Brazil 2016 - 5 fundamentos essenciais de padrões xUnit
stefanteixeira
0
130
Latinoware 2016 - Continuous Delivery com ferramentas open source
stefanteixeira
0
82
Ágiles 2016 - Using open source tools to support Continuous Delivery
stefanteixeira
0
69
6º Encontro do Grupo de Testes Carioca - Testes em um contexto de Continuous Delivery
stefanteixeira
0
56
TDC 2016 SP - Desmistificando cobertura de código como métrica de qualidade
stefanteixeira
0
150
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-source
stefanteixeira
0
100
TDC 2016 SP - Cobertura de código de procedures T-SQL com SQLCC
stefanteixeira
0
88
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
stefanteixeira
0
82
Other Decks in Programming
See All in Programming
はじめてのPLATEAU
nokonoko1203
1
670
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
The Cost of the DOM
ypresto
2
210
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
180
[DroidKnights 2026] Workflow AX 적용기 — 자동 정책 정리부터 E2E까지
dayeon
0
120
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
470
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
210
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
510
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
420
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
110
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
340
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
190
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
For a Future-Friendly Web
brad_frost
184
11k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3.1k
Designing Powerful Visuals for Engaging Learning
tmiket
1
660
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
2
4k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1.1k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k