在Play中运行规范时,“连接被拒绝:没有进一步的信息”错误

时间:2018-06-05 18:55:13

标签: intellij-idea scalatest playframework-2.6

我创建了一个使用WsTestClient的规范。当我运行测试时(右键单击并选择run ScalaTest in test中的IntelliJ),我收到以下错误 - Connection refused: no further information: localhost/0:0:0:0:0:0:0:1:9190。我做错了什么?

我的测试用例是

class UserControllerSpec extends AsyncWordSpec {

  implicit val port:play.api.test.WsTestClient.Port = 9190;

    "User signup request with non-JSON body" must {
      "return  400 (Bad Request) and the validation text 'Incorrect body type. Body type must be JSON'" in {
        val request = WsTestClient.wsUrl("/ws/users/signup")
        val responseFuture = request.get()
        println("sending dummy signup up request")
        responseFuture.map(response =>{
          println("response :"+response);
          assert(response.status == play.api.http.Status.BAD_REQUEST)
        })
      }
    }
}

对我来说,问题似乎是没有服务器来响应这个客户端。但我假设Play将自己启动一些服务器。

0 个答案:

没有答案