测试结果输出重复



我正在使用游戏框架 2.2.1,并希望使用 scalatest 而不是 specs2。所以我添加了 scalatest 依赖项:

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"

我还使用 FunSuite 重写了测试:

class AppTest extends FunSuite {
    test("Application sends 404") {
        new WithApplication {
            assert(route(FakeRequest(GET, "/asdf")).isEmpty)
        }
    }
    test("Application renders index") {
        new WithApplication {
            val home = route(FakeRequest(GET, "/")).get
            assert(status(home) == OK)
            assert(contentType(home) == Some("text/html"))
            assert(contentAsString(home).contains("Hello world"))
        }
    }
}

现在,当我从播放管理中心(或 sbt)运行test时,我会得到两次测试结果:

[info] AppTest:
[info] - Application sends 404
[info] - Application renders index
[info] AppTest
[info] + Application sends 404
[info] + Application renders index
[info] 
[info] 
[info] Total for test AppTest
[info] Finished in 0.021 seconds
[info] 2 tests, 0 failures, 0 errors

这不是一个大问题,因为我认为测试实际上并没有执行两次,但它有点令人困惑,尤其是当有更多的测试时。

有人遇到过这种情况吗?

谢谢

加号和缺少冒号表示第二个来自 specs2 测试类。我想你一定把它放在一边,所以sbt同时运行ScalaTest和specs2

最新更新