我試着用ScalaTest作爲我的構建系統。我試圖使用example code:帶有標籤和螞蟻的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>
它編譯就好了,並運行該套件,但不包括測試。我希望它能夠在上面的代碼中運行兩個測試中的第一個。輸出如下:
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.
任何想法,爲什麼這是?任何幫助將非常感激。