ビルド システムとして ant を使用して ScalaTest を試しています。サンプルコードを使用しようとしています:
package se.uu.molmed.SandBoxScalaTest
import org.scalatest.FlatSpec
import org.scalatest.Tag
object SlowTest extends Tag("com.mycompany.tags.SlowTest")
object DbTest extends Tag("com.mycompany.tags.DbTest")
class TestingTags extends FlatSpec {
"The Scala language" must "add correctly" taggedAs(SlowTest) in {
val sum = 1 + 1
assert(sum === 2)
}
it must "subtract correctly" taggedAs(SlowTest, DbTest) in {
val diff = 4 - 1
assert(diff === 3)
}
}
そして、次のantターゲットを使用して実行しようとしています:
<!-- Run the integration tests -->
<target name="slow.tests" depends="build">
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask">
<classpath refid="build.classpath" />
</taskdef>
<scalatest parallel="true">
<tagstoinclude>
SlowTests
</tagstoinclude>
<tagstoexclude>
DbTest
</tagstoexclude>
<reporter type="stdout" />
<reporter type="file" filename="${build.dir}/test.out" />
<suite classname="se.uu.molmed.SandBoxScalaTest.TestingTags" />
</scalatest>
</target>
問題なくコンパイルされ、スイートが実行されますが、テストは含まれていません。上記のコードの 2 つのテストのうち最初のテストを実行することを期待しています。出力は次のようになります。
slow.tests:
[scalatest] Run starting. Expected test count is: 0
[scalatest] TestingTags:
[scalatest] The Scala language
[scalatest] Run completed in 153 milliseconds.
[scalatest] Total number of tests run: 0
[scalatest] Suites: completed 1, aborted 0
[scalatest] Tests: succeeded 0, failed 0, ignored 0, pending 0, canceled 0
[scalatest] All tests passed.
これがなぜなのかについてのアイデアはありますか?どんな助けでも大歓迎です。