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
TDC 2016 Floripa - Testing REST APIs with Super...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Stefan Teixeira
May 12, 2016
Programming
51
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
91
Agile Brazil 2016 - 5 fundamentos essenciais de padrões xUnit
stefanteixeira
0
120
Latinoware 2016 - Continuous Delivery com ferramentas open source
stefanteixeira
0
75
Ágiles 2016 - Using open source tools to support Continuous Delivery
stefanteixeira
0
65
6º Encontro do Grupo de Testes Carioca - Testes em um contexto de Continuous Delivery
stefanteixeira
0
51
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
94
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
68
Other Decks in Programming
See All in Programming
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4k
yield再入門 #phpcon
o0h
PRO
0
970
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.5k
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
180
継続モナドとリアクティブプログラミング
yukikurage
3
690
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
170
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
150
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.7k
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
プロポーザルを書いてもらう
pvcresin
0
280
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
530
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
890
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
Technical Leadership for Architectural Decision Making
baasie
3
470
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Exploring anti-patterns in Rails
aemeredith
3
460
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
280
KATA
mclloyd
PRO
35
15k
The browser strikes back
jonoalderson
0
1.5k
HDC tutorial
michielstock
2
780
Being A Developer After 40
akosma
91
590k
BBQ
matthewcrist
89
10k
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!