2012-12-10 5 views
15

あなたはSBTプロジェクトで定義された2つのテストしている場合:SBTでどのように1つのSpec2仕様のみを実行しますか?

class Spec1 extends Specification { 
    def is = 
    "Tests for specification 1"^
     p^
     "Test case 1" ! todo^
     end 
} 

class Spec2 extends Specification { 
    def is = 
    "Tests for specification 2"^
     p^
     "Test case 2" ! todo^
     end 
} 

を次にSBT内部からtestを実行すると、これらのテストの両方を実行しますが。これらのテストのうちの1つだけを実行する最も簡単な方法は何ですか?

答えて

19

test-only sbtコマンドを使用してください。

sbt> test-only com.example.MySpec 

ワイルドカードを使用して、一連のテストを実行することもできます。 を参照してくださいHow to execute tests that match a regular expression only?

+8

最初に 'sbt'シェルを入力しない場合は、実行可能ファイルには1つの引数しかないので、コマンド全体を引用符で渡す必要があります。ここでは、 'sbt" test-only com.example.MySpec "または' sbt "テスト専用* MySpec" ' – broadmonkey

関連する問題