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
820
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
AIは推し活である。
kurazuuuuuu
1
960
あけおめLINE 傾向とその対策
nasa9084
0
320
SREの視点で考えるSIEM活用術 〜AWS環境でのセキュリティ強化〜
cscengineer
PRO
0
320
AI coding 整合正規方法
philipz
0
540
Why Agent Cost Needs Observability
nttcom
0
150
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
290
「大丈夫そう?」をObservabilityで確かめる
mrmtsu
0
110
絵ではじめるKubernetesセキュリティ
aoi1
5
710
AIに書かせて、プラットフォームで縛る ― EKSプラットフォームで実践した責任境界と権限設計
elmodev09
0
270
ScotSecure West 2026 - Glasgow
raybugg
0
160
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
32
21k
Making AI Agents Safe and Fast- Jev, Obsidian, and the Meta-Harness
x5gtrn
PRO
0
140
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
580
Evolving SEO for Evolving Search Engines
ryanjones
0
300
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
480
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
250
Marketing to machines
jonoalderson
1
5.8k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Mobile First: as difficult as doing things right
swwweet
225
10k
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