まえがき Kotlin Advent Calendar 2017 - Qiitaの14日目です。 ユニットテストを書く時に、もっといい感じに書きたいっと思う時があります。 そんなとき、Spek - A Kotlin Specification Framework for the JVMを発見しました。Androidで試してみました。 Androidでの導入は最後に書きます。 まずはSpekとJUnit4でのソースをみてみます。 Kotlin前提ですが、デフォルトはもうKotlinでいいよね? 比較 テスト対象 class SampleCalculator { fun sum(x: Int, y: Int): Int = x + y fun subtract(x: Int, y: Int): Int = x - y } Spekで書いてみる @RunWith(JUnitPlatform::c