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
使い捨てAPIテストのすすめ
Search
izumix03
February 09, 2024
Business
0
120
使い捨てAPIテストのすすめ
izumix03
February 09, 2024
Tweet
Share
Other Decks in Business
See All in Business
Company Introduction Slides
recruiting
0
980
全社プロダクトマネジメント! 職能と職位を乗り越えて若々しいチームを実現しよう/create a agile team beyond roles and ranks
moriyuya
3
290
Карта гипотез для ментора
alexanderbyndyu
0
1k
Cloud Run で作るサーバーレス アーキテクチャ 30 連発 - これのときはこう!
googlecloudjapan
24
7.8k
ワンメディア株式会社 会社紹介資料
sakiyogoro
0
9k
マイナンバーを活用した申請手続の簡素化
tokyo_metropolitan_gov_digital_hr
2
110
朝日新聞社 ITエンジニア キャリア採用 紹介資料
asahi_cto
0
410
Tokyo支援ナビ
tokyo_metropolitan_gov_digital_hr
1
110
ガバメントクラウド(AWS)のあれこれ
mujyun
1
600
From Strategy to Practice: Insights on How Team Topologies Drives Organizational Success
mfpais
PRO
0
340
ネクストビートコーポレートガイド/corporate-guide
nextbeat
2
75k
メタバースを活用した東京の魅力発信
tokyo_metropolitan_gov_digital_hr
1
110
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
27
1.9k
Designing for Performance
lara
604
68k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
46
4.9k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Making Projects Easy
brettharned
115
5.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Docker and Python
trallard
40
3k
Designing with Data
zakiwarfel
98
5.1k
4 Signs Your Business is Dying
shpigford
180
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2k
Transcript
使い捨てAPIテストのすすめ ~取得系APIのリプレイスで使えるTips~ DeNA SOMPO Mobility 泉川 貴洋
WEB APIのリプレイって⼤変... 2 実際にやってよかったTips 使い捨てAPIテスト どういう仕様?複雑すぎる... テストもない... 既存APIと同じ挙動を保証?!!
3 泉川 貴洋 / いずみかわ たかひろ 所属 DeNA SOMPO Mobility
グロース本部プロダクト開発部 担当 Anyca サーバサイドエンジニア 出⾝ ⾹川県 家族構成 妻と2歳の娘の3⼈家族 @izumix0303
エニカとは 新型⾞‧⾼級⾞など1,300以上の⾞種に乗れる、 個⼈間を中⼼としたカーシェアサービス。 カーシェアを通じた理想のライフスタイルを提供 4
‧データ準備(登録, DB Dump,etc...) ‧リクエストと正解レスポンスを定義 ‧CIなどで継続的に実⾏ 5 使い捨てAPIテスト? ⼀般的なAPIテスト 使い捨てAPIテスト ‧データ準備(登録,
DB Dump,etc...) ‧リクエストだけ定義 ‧開発終わったら破棄 = 使い捨て
使い捨てAPIテストの構築⼿順 ①古いエンドポイント 旧 新 ②新エンドポイントを 別に作る ③テストを書く GET old/hoge/1 レスポンス取得
新旧のレスポンス⽐較! GET new/hoge/1 ④開発 DB
使い捨てAPIテストの作り⽅ ‧Jupyter Labで作る ‧pythonに変換して実⾏ ‧pytest-clarity で差分を⾒やすくする
Jupyter Labで作る 対話的に確認しながら作れる
Pythonに変換 Makefileの例 Pythonに変換しながら Pytestを実⾏ NOTEBOOKS:=$(shell find src/test -name "*.ipynb") PYS:=$(NOTEBOOKS:.ipynb=.py)
.PHONY: convert convert: $(PYS) %.py: %.ipynb $(VENV)/jupyter nbconvert --to python $< .PHONY: test test: convert $(VENV)/pytest -vv ./src/test/**/*.py include Makefile.venv
pytest-clarity で差分を⾒やすくする JSONの差分を、 ⾊付けして ⾒せてくれる
使い捨てAPIテストのメリット 作りやすさ 簡単に 作れる 質 保証内容が 確実 量 パターンも ⼗分確保
Let's 快適なAPIリプレイス!