3
我有一個簡單的基於FunSuite
ScalaTest:在ScalaTest中使用SBT時,可以安全地忽略ScalaCheck/Specs警告嗎?
package pdbartlett.hello_sbt
import org.scalatest.FunSuite
class SanityTest extends FunSuite {
test("a simple test") {
assert(true)
}
test("a very slightly more complicated test - purposely fails") {
assert(42 === (6 * 9))
}
}
我敢用下面的SBT項目配置運行:
import sbt._
class HelloSbtProject(info: ProjectInfo) extends DefaultProject(info) {
// Dummy action, just to show config working OK.
lazy val solveQ = task { println("42"); None }
// Managed dependencies
val scalatest = "org.scalatest" % "scalatest" % "1.0" % "test"
}
然而,當我運行sbt test
我得到以下警告:
...
[info] == test-compile ==
[info] Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling test sources...
[info] Nothing to compile.
[warn] Could not load superclass 'org.scalacheck.Properties' : java.lang.ClassNotFoundException: org.scalacheck.Properties
[warn] Could not load superclass 'org.specs.Specification' : java.lang.ClassNotFoundException: org.specs.Specification
[warn] Could not load superclass 'org.specs.Specification' : java.lang.ClassNotFoundException: org.specs.Specification
[info] Post-analysis: 3 classes.
[info] == test-compile ==
...
現在我假設這些只是「噪音」(由統一測試接口引起的)和臨時我可以放心地忽略它們。但它對我的某些內部OCD部分有些惱人(儘管我不打算爲其他框架添加依賴關係)。
這是一個正確的假設,還是在我的測試/配置代碼中有微妙的錯誤?如果可以忽略的話,還有其他方法可以抑制這些錯誤嗎?或者人們是否經常包含所有三種框架,以便他們能夠爲不同的測試選擇最佳的方法?
TIA, Paul。
(增加:斯卡拉v2.7.7和SBT v0.7.4)
謝謝,很高興知道! – pdbartlett 2010-06-16 17:50:53