我有一个简单的基于FunSuite-ScalaTest:

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"                                    
}

然而,当我runsbt 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, 保罗。

(增加:阶v2.7.7和SBT v0.7.4)

有帮助吗?

解决方案

标记哈拉斯说,这是安全的忽视,而本来是0.7.4之前是固定的,但他忘了。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top