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
The JSON generator tool based on Google Spreads...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
takuoki
December 18, 2018
Technology
800
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
MulticaとPi Coding Agentで、小規模OSSを30本同時運用した流れ
eiei114
0
120
Kiro Crew入門 - 常駐エージェントの仕組みと使いどころ / Intro to Kiro Crew
k_adachi_01
1
130
20分でわかるセキュアAPI
nwiizo
2
280
Bits AI を制するものは Datadog を制す / The player that controls Bits AI, controls Datadog
kaminashi
0
110
Webアクセシビリティ入門 2026
recruitengineers
PRO
3
580
SmartHR Engineering Team Deck
smarthr
1
2.2k
【CEDEC2026】Creative Approaches to Localizing the Dialects and Unique Speech of Umamusume: Pretty Derby Characters in English
cygames
PRO
3
23k
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
140
Software Supply Chain Attackからクラウド環境を守るためにできること
lhazy
2
260
その“隠したつもり”が命取り ── 自前と平文をやめて「正解」に委ねる
kuroneko13
0
120
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
19k
同じWAFが、攻撃の“形”は弾く── 正当な“形”の不正は通す
kuroneko13
0
200
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
340
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
430
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Leo the Paperboy
mayatellez
8
2.1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Color Theory Basics | Prateek | Gurzu
gurzu
0
420
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.8k
Design in an AI World
tapps
1
280
A better future with KSS
kneath
240
18k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
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