Open3

runn触ってみたい

yagihashyagihash

何をどこまでやるか

  • 気の向くままチュートリアル触ってみる
  • Goのテストへの組み込みが気になるのでそこまでは何らかの形で触る
yagihashyagihash

チュートリアル

趣旨

https://zenn.dev/katzumi/articles/api-scenario-testing-with-runn

API 単体でのテストは上記以外も数多く存在しましたが、API をチェーンして呼び出すシナリオテストをするには難しそうと判断しました。

runnをインストールしてみよう

brew install k1LoW/tap/runn
❯ runn help
runn is a tool for running operations following a scenario.

Usage:
  runn [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  coverage    show coverage for paths/operations of OpenAPI spec and methods of protocol buffers
  help        Help about any command
  list        list runbooks
  loadt       run load test using runbooks
  new         create new runbook or append step to runbook
  rprof       read the runbook run profile
  run         run scenarios of runbooks

Flags:
  -h, --help             help for runn
      --scopes strings   additional scopes for runn
  -v, --version          version for runn

Use "runn [command] --help" for more information about a command.

楽ちん。

Hello world!

runbookというyaml形式でシナリオ定義。

desc: まずはお馴染みHello world!
steps:
  -
    dump: "'Hello world!'"
❯ runn run hello_world.yaml 
Hello world!
.

1 scenario, 0 skipped, 0 failures

"'{文字列}'" このあたりがちょっとトリッキーかも。(しゃーなし感はあるが)