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 - Testando APIs REST com Supertest e Promises
Search
Stefan Teixeira
May 12, 2016
Programming
0
26
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
Tweet
Share
More Decks by Stefan Teixeira
See All by Stefan Teixeira
Scrum Gathering Portugal 2016 - Containerizing Tests with Docker
stefanteixeira
0
76
Agile Brazil 2016 - 5 fundamentos essenciais de padrões xUnit
stefanteixeira
0
100
Latinoware 2016 - Continuous Delivery com ferramentas open source
stefanteixeira
0
58
Ágiles 2016 - Using open source tools to support Continuous Delivery
stefanteixeira
0
47
6º Encontro do Grupo de Testes Carioca - Testes em um contexto de Continuous Delivery
stefanteixeira
0
39
TDC 2016 SP - Desmistificando cobertura de código como métrica de qualidade
stefanteixeira
0
110
TDC 2016 SP - Continuous Delivery para aplicações Java com ferramentas open-source
stefanteixeira
0
79
TDC 2016 SP - Cobertura de código de procedures T-SQL com SQLCC
stefanteixeira
0
64
TDC 2016 SP - 5 libs de teste JavaScript que você deveria conhecer
stefanteixeira
0
57
Other Decks in Programming
See All in Programming
PHPコードの実行モデルを理解する / Understanding-the-PHP-Execution-Model
shin1x1
0
880
Revisiting the Hotwire Landscape after Turbo 8 @ RailsConf 2024, Detroit
marcoroth
3
600
“Seeing Like a Programmer”—Resiliency, Limits, and Moral Hazards in Software Engineering (LambdaConf 2024)
chriskrycho
0
420
Exploring Type-Informed Lint Rules in Rust based TypeScript Linters
unvalley
3
620
酒飲んでたらテックリードになった話
spbaya0141
0
200
Balkan Ruby 2024 — How and why to run SQLite on Rails in production
fractaledmind
0
110
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
600
TypeScriptコードの漸進的改善 / Progressive Improvement of TypeScript Code
medley
1
410
Ruby on Fails - effective error handling with Rails conventions
talyssonoc
0
280
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
480
株式会社ゼネテック
genetec
0
120
Fast JSX: Don't clone props object #28768
yossydev
1
230
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
74
8.3k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
126
32k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Design by the Numbers
sachag
274
18k
RailsConf 2023
tenderlove
9
580
Mobile First: as difficult as doing things right
swwweet
217
8.6k
Adopting Sorbet at Scale
ufuk
69
8.6k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Producing Creativity
orderedlist
PRO
338
39k
Designing for humans not robots
tammielis
247
25k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Bash Introduction
62gerente
605
210k
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!