【发布时间】:2015-08-12 15:59:29
【问题描述】:
我正在尝试对我克隆的项目进行测试。我是 Scala 和 Activator 的新手,我不知道发生了什么
在根文件夹中我有build.sbt
name := "xxxxx"
version := "2.0-SNAPSHOT"
scalaVersion := "2.11.5"
doc in Compile <<= target.map(_ / "none")
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature")
lazy val root = (project in file(".")).enablePlugins(PlayScala)
libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"org.scalatest" % "scalatest_2.11" % "2.2.4" % "test",
"json-module" %% "json-module" % "2.0.0",
)
instrumentSettings
ScoverageKeys.excludedPackages in ScoverageCompile := "<empty>;views*;views.*;views*html;Routes*;controllers*routes*;controllers*Reverse*;controllers*javascript*;controller*ref*"
ScoverageKeys.highlighting := true
这是一个示例文件
class TestExampleSpec extends AbstractSpec {
"TestExample#get(:testId)" must {
val url = controllers.routes.TestExample.get(1, 1, 10).url
"return 400 without X-Client-Id header" in {
val fakeRequest = FakeRequest("GET", url).withTextBody("")
val result: Future[Result] = controllers.TestExample.get(1, 1, 10)(fakeRequest)
status(result) mustBe 400
contentType(result) mustBe Some("application/json")
val body = contentAsString(result)
val bodyJson = Json.parse(body)
(bodyJson \ "error").asOpt[Boolean] mustBe Some(true)
(bodyJson \ "message").asOpt[String] mustBe Some("Missing X-Client-Id header")
}
我试过这个命令
$ activator reload
$ activator clean
$ activator test
但这些都不起作用我收到这种消息
home/username/code/testing-project/test/TestExampleSpec.scala:10: value in is not a member of String
"return 400 without X-Client-Id header" in {
谢谢
【问题讨论】:
标签: scalatest typesafe-activator