【发布时间】:2017-02-09 13:15:48
【问题描述】:
scala play 框架的默认集成规范如下:
class IntegrationSpec extends PlaySpec with OneServerPerTest with OneBrowserPerTest with HtmlUnitFactory {
"Application" should {
"work from within a browser" in {
go to ("http://localhost:" + port)
pageSource must include ("Your new application is ready.")
}
}
}
单击port 变量打开OneServerPerTest.scala 文件:
/**
* The port used by the `TestServer`. By default this will be set to the result returned from
* `Helpers.testServerPort`. You can override this to provide a different port number.
*/
lazy val port: Int = Helpers.testServerPort
单击Helpers.testServerPort 会导致:
/**
* The port to use for a test server. Defaults to 19001. May be configured using the system property
* testserver.port
*/
lazy val testServerPort = Option(System.getProperty("testserver.port")).map(_.toInt).getOrElse(19001)
搜索testserver.port 不会返回变量。当默认端口是 9000 并且 testserver.port 定义在哪里时,测试怎么可能成功?
【问题讨论】:
标签: scala playframework