Scala akka的gradle测试和测试套件
我有一个Scala+Akka+Gradle应用程序和以下测试:Scala akka的gradle测试和测试套件,scala,gradle,akka,akka-testkit,Scala,Gradle,Akka,Akka Testkit,我有一个Scala+Akka+Gradle应用程序和以下测试: class UserCRUDSpec() extends TestKit(ActorSystem("UserCRUDSpec")) with ImplicitSender with WordSpecLike with Matchers with Mockito with DomainSuit { val userDao: UserDao = mock[UserDao] val actor: ActorR
class UserCRUDSpec() extends TestKit(ActorSystem("UserCRUDSpec"))
with ImplicitSender
with WordSpecLike
with Matchers
with Mockito
with DomainSuit {
val userDao: UserDao = mock[UserDao]
val actor: ActorRef = system.actorOf(UserCRUD.props(self, userDao))
"The UserCRUD actor " must {
"search actor by id if actorId specified and exists" in {
...
}
}
}
和gradlebuild.gradle
依赖项:
apply plugin: 'scala'
dependencies {
compile 'org.scala-lang:scala-compiler:2.12.6'
compile('com.typesafe.akka:akka-cluster_2.12:2.5.14') {
exclude group: 'org.scala-lang'
}
testCompile ('com.typesafe.akka:akka-testkit_2.12:2.5.14') {
exclude group: 'org.scala-lang'
}
testCompile ('org.scalatest:scalatest_2.12:3.0.5') {
exclude group: 'org.scala-lang'
}
testCompile ('org.specs2:specs2-core_2.12:4.3.3') {
exclude group: 'org.scala-lang'
}
testCompile ('org.specs2:specs2-mock_2.12:4.3.3') {
exclude group: 'org.scala-lang'
}
}
}
当我运行
/gradle test
时,它说找不到任何测试。是否有任何方法可以添加TestKit测试,使其在gradle测试任务中可见?最后,我切换到scalatest和specified actor系统:
class UserCRUDSpec() extends WordSpec with TestKitBase ... {
...
implicit lazy val system: ActorSystem = ActorSystem("UserCRUDSpec")
...
}