LoginSignup
1
0

More than 1 year has passed since last update.

GoLandでGinkgoを利用する - External Tools利用編

Last updated at Posted at 2021-06-17

はじめに

GoLandには指定したtest funcのみテストをGUI上から選んで実行するような素晴らしい機能が存在しますが、Ginkgo等のgolang標準のtestingの仕組みから外れたライブラリを使用するとそれらを利用できなくなります。

go test -ginkgo.v -ginkgo.focus "test case"

のようにコマンドラインで実行したいテストケースを指定することは可能ですが
せっかくGoLandを利用しているのですからGUIから Describe("test case") もしくは Context("sub test case")
を実行するためにGolandのExternal Toolsから呼び出せるように設定していきます。

GoLand の External Tools で Ginkgo を呼び出す

External Tools作成

  • GoLand -> Preferences -> Tools -> External Tools を選択
  • + ボタンを押下して Create Toolを開き以下のToolを作成
Name             : Ginkgo 
Description      : run Ginkgo test selected test case
Program          : $GoExecPath$
Arguments        : test -ginkgo.v -ginkgo.focus "$SelectedText$"
Working directory: $FileDir$

$SelectedText$ のマクロで選択した文字列を拾ってきています。

使い方

  • テストケースのテキストを選択する
    image.png

  • 右クリックメニューから External Tools -> Ginkgo を選択
    image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0