2013-12-20 68 views
0

我正在使用play framework 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 

这不是一个大问题,因为我不认为测试实际上执行过两次,但是有点让人困惑,特别是当有更多测试时。

有没有人遇到过这个?

感谢

回答

0

加号和缺乏一个冒号表示第二个是从specs2测试类。我想你一定已经放弃了,所以sbt同时运行ScalaTest和specs2。

+0

是的,我想过,但我找不到任何参考。我认为play sbt插件将它添加为依赖项,我不知道如何删除它。 –

相关问题