Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The JSON generator tool based on Google Spreads...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Avatar for takuoki takuoki
December 18, 2018

The JSON generator tool based on Google Spreadsheets

Avatar for takuoki

takuoki

December 18, 2018

Other Decks in Technology

Transcript

  1. I’ve created a tool for such cases! 6 Google Spreadsheetに書いたテストケースから、

    JSONファイルを作成するツール”testmtx”を作った! JSONファイルをGoで読み込めば、”go test”でテストもできる! Google Spreadsheet JSON files for test testmtx
  2. 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 }
  3. How to output files 12 コマンドラインツールで、シートIDを指定すればOK! • 設定ファイルで、シートIDのエイリアスを定義できる。 • Google

    Sheets APIを使用しているので、OAuth認証が必要。 $ testmtx out -s 1Zs2HI7x8eQ05ICoaBdv1I1ny_KtmtrE05Lyb7OwYmdE output completed successfully!
  4. Conclusion 14 • Goでのツールの実装について ◦ ASTを初めて触って楽しかった! • 良かった点 ◦ テストデータが膨大になっても、なんとかメンテナンスできる。

    ◦ 単純にJSONを吐き出すツールなので汎用的(テスト以外でも可)! • 気になる点 / 反省点 ◦ Sheet自体はGit管理外なので、ブランチころころ変えてると気になる。 ◦ テストのツールなのにテストコードをかけていない!! • その他 ◦ 反応があったら改善するモチベーションに! https://github.com/takuoki/testmtx
  5. End