2012-12-10 27 views
15

Eğer SBT projede tanımlanan 2 testleri varsa:SBT ile yalnızca tek bir Spec2 belirtimini nasıl çalıştırıyorsunuz?

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

ve

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

Sonra SBT içinden test çalışan bu testleri hem çalıştırır. Bu testlerden sadece birini çalıştırmanın en kolay yolu nedir?

cevap

19

test-only sbt komutunu kullanın.

sbt> test-only com.example.MySpec 

Bir dizi testi çalıştırmak için joker karakter kullanabilirsiniz. Bkz. How to execute tests that match a regular expression only?

+8

Önce "sbt" kabuğuna girmek istemezseniz, yürütülebilir dosya yalnızca tek bir argüman bekler, dolayısıyla tüm komutu tırnak içine almanız gerekir. Burada, sbt "salt test com.example.MySpec" veya "sbt" yalnızca test * MySpec " – broadmonkey

İlgili konular