0

ねえ、akka アクター アプリケーション用の小さな Funsuite テストを作成したいのですが、Testkit を FunSuiteLike と組み合わせた後、もうテストを呼び出すことができません。誰かがなぜこれが起こっているのか考えていますか? Testkit と funsuite は互換性がありませんか?

import org.scalatest.{FunSuiteLike, BeforeAndAfterAll}
import akka.testkit.{ImplicitSender, TestKit, TestActorRef}
import akka.actor.{ActorSystem}

class ActorSynchroTest(_system: ActorSystem) extends TestKit(_system) with FunSuiteLike with BeforeAndAfterAll with ImplicitSender{


  val actorRef =  TestActorRef(new EbTreeDatabase[Int])
  val actor = actorRef.underlyingActor

  //override def afterAll = TestKit.shutdownActorSystem( system )

  test("EbTreeDatabase InsertNewObject is invoked"){
    val idList = List(1024L,1025L,1026L,1032L,1033L,1045L,1312L,1800L)
      idList.
      foreach(x => actorRef ! EbTreeDataObject[Int](x,x,1,None,null))
    var cursor:Long = actor.uIdTree.firstKey()
    var actorItems:List[Long] = List(cursor)

    while(cursor!=actor.uIdTree.lastKey()){
      cursor = actor.uIdTree.next(cursor)
      cursor :: actorItems
    }
    assert(idList.diff(actorItems)  == List())
  }
}

intelliJ アイデア テスト環境には次のように書かれています。

One or more requested classes are not Suites: model.ActorSynchroTest
4

1 に答える 1

1
class ActorSynchroTest extends TestKit(ActorSystem("ActorSynchroTest",ConfigFactory.parseString(ActorSynchroTest.config)))
with DefaultTimeout with ImplicitSender
with FunSuiteLike with Matchers with BeforeAndAfterAll  {
 ...

}

object ActorSynchroTest {
  // Define your test specific configuration here
  val config = """
akka {
loglevel = "WARNING"
}
               """
}

テストキットの異なる初期化は、適合しない標準構成が使用される前に最終的に機能しました

于 2014-08-19T20:09:39.737 に答える