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
The JSON generator tool based on Google Spreads...
Search
takuoki
December 18, 2018
Technology
830
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The JSON generator tool based on Google Spreadsheets
takuoki
December 18, 2018
Other Decks in Technology
See All in Technology
新米を「売り越さない」、Aurora DSQLで作る在庫ゼロ死守の限定ドロップEC
yama3133
0
180
業務でAWSをあまり使っていない私が、AWSへのモチベを保つ方法
smt7174
0
160
増え続けるプロダクトの品質をどう担保するか。ProductSpecとTypeScriptによる取り組み
joere
3
480
AIエージェントの監視、思考を見るか行動を見るか / Monitoring AI Agents: Thoughts or Actions
yusukeshimizu
2
170
AI Agent 時代のデータ基盤: ClickHouse で実現する 超高速分析とコスト削減の両立
jozono
0
200
Lint の層を組み直した話
bengo4com
3
320
The future of architectural work
ufried
0
170
[General] 개발자로 해외 기업에서 일하기
skydoves
1
300
詳解 never 型 - ボトム型の性質を深掘り
nealle
0
160
生き様としてのSRE
hokkai7go
1
170
Microsoft Entra Kerberos で実現するクラウド デバイス管理
tamaiyutaro
2
600
Kiro 入門 (1 つのエージェントを、どの画面からでも) | 目指せ Kiro マスター 01
inariku
PRO
4
830
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
390
Become a Pro
speakerdeck
PRO
31
6.4k
The Curious Case for Waylosing
cassininazir
1
610
Facilitating Awesome Meetings
lara
57
7.2k
Speed Design
sergeychernyshev
33
2.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
It's Worth the Effort
3n
188
29k
Deep Space Network (abreviated)
tonyrice
0
410
Building an army of robots
kneath
307
47k
Transcript
Goでテスト仕様書からJSONファイルを 自動生成するツールを作ったよ - The JSON generator tool for tests 2018-12-18
golang.tokyo #20 LT Takuo OKI
About me 2 • もともと7年くらいSIer。 • いまはVELTRAという旅行関連の会社でGoを書いています。 • 技術ブログを気まぐれに書いています。 Let’s
search “veltra engineering blog”! GitHub: takuoki Twitter: takuokl ←”i”じゃなくて”l”!
Do you write tests? テスト、書いてますか?
Unit test is so good! 4 Goはユニットテストが簡単に書けて、メンテナンスもしやすい。
How about integration test? 5 インテグレーションテストについてはあまり資料がない。。 例)APIのリクエストとレスポンスをまるごと確認したい。 → データが大きいのでGoのソースに テストデータを書くわけにもいかない。。
I’ve created a tool for such cases! 6 Google Spreadsheetに書いたテストケースから、
JSONファイルを作成するツール”testmtx”を作った! JSONファイルをGoで読み込めば、”go test”でテストもできる! Google Spreadsheet JSON files for test testmtx
How to write spreadsheet 7
How to write spreadsheet 8 JSONのプロパティ定義を書く
How to write spreadsheet 9 テストケース毎のデータを埋める ※1列=1テストケース
How to write spreadsheet 10 object型やarray型は"*new"と書く
How to write spreadsheet 11 1テストケースで複数の JSONファイルを作成 { "num_key": 101,
"string_key": "string value 101", "bool_key": true, "object_key": { "key1": 201, "key2": "string value 201" }, "array_key": [ { "key3": 301, "key4": "string value 301" }, { "key3": 401, "key4": "string value 401" } ] } { "status": “success”, "code": 200 }
How to output files 12 コマンドラインツールで、シートIDを指定すればOK! • 設定ファイルで、シートIDのエイリアスを定義できる。 • Google
Sheets APIを使用しているので、OAuth認証が必要。 $ testmtx out -s 1Zs2HI7x8eQ05ICoaBdv1I1ny_KtmtrE05Lyb7OwYmdE output completed successfully!
Supplemental features 13 • JSONのプロパティ定義をいちから書くのは面倒なので、 Goの構造体を読み込んでテキスト出力できる。 • プロパティ定義の階層を調整できる。 • 設定ファイルで対象外のシートを指定できる。
• YAMLも一応サポートしている。
Conclusion 14 • Goでのツールの実装について ◦ ASTを初めて触って楽しかった! • 良かった点 ◦ テストデータが膨大になっても、なんとかメンテナンスできる。
◦ 単純にJSONを吐き出すツールなので汎用的(テスト以外でも可)! • 気になる点 / 反省点 ◦ Sheet自体はGit管理外なので、ブランチころころ変えてると気になる。 ◦ テストのツールなのにテストコードをかけていない!! • その他 ◦ 反応があったら改善するモチベーションに! https://github.com/takuoki/testmtx
End