scala play框架中默认IntegrationSpec中定义的端口在哪里?

scala play框架中默认IntegrationSpec中定义的端口在哪里?,scala,playframework,Scala,Playframework,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) page

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.")
    }
  }
}
单击
端口
变量打开
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
时,测试如何成功?

使用此端口启动
testserver
,如下所示。9000端口是开发模式的默认端口,而不是所有测试模式。如果在用于启动测试的命令中未设置
testserver.port
属性,则将使用默认属性(19001)