// system.actorOf(Props(new ABC),"abc")
val abcRef = TestActorRef[ABC]
I've got an AskTimeoutException in some test code that I'm not sure how to fix.[error] Could not run test com.myfirm.abcTest.ABCTestSpec: java.util.concurrent.TimeoutException: Futures timed out after [5000] milliseconds
[error] Error: Total 0, Failed 0, Errors 0, Passed 0, Skipped 0[error] Error during tests:[error] com.myfirm.abcTest.ABCTestSpec[error] {file:/../../../MyProject}MyProject/test:test: Tests unsuccessful[error] Total time: 7 s, completed May 1, 2012 1:42:44 PMI'm basically hacking some code together just to figure out what I have available to me w.r.t. testing. Also, I haven't tried to use akka TestKit or ScalaTest prior to this, so please excuse any glaring omissions. So far, I have the following do-nothing code. Is it just a matter of changing the timeout in the configuration?
If so, which value do I change?
Also, is there going to be an issue with accessing the underlying actor both through it's actorRef and directly?
Thanks in advance,Bruceimport org.scalatest._import org.scalatest.matchers._import akka.actor._import akka.actor.Actor._import akka.util.duration._import akka.testkit._import java.util.concurrent.TimeUnitimport com.typesafe.config._import util.Randomimport com.myfirm.messages._import com.myfirm.abc._class ABCTestSpec extends FlatSpec with ShouldMatchers {implicit val system = ActorSystem("system", ConfigFactory.load())// system.actorOf(Props(new ABC),"abc")val abcRef = TestActorRef[ABC]val abc = abcRef.underlyingActor"This" should "do that" in {abcRef ! "blah"abc.computeValue("XYZ")abc.valueMap("XYZ") should be(0.0)}}
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/5TDuwcBqBbsJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn
Hi Bruce,
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/fBLLlsJ8PIoJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
class Junk extends Actor {
val log = Logging(context.system,this)
def colour = "Blue"
def receive = {
case msg => println("blah")
}
}
object Junk {
val config = ConfigFactory.load()
val system = ActorSystem("system", config)
val junk = system.actorOf((Props(new Junk)),"junk")
}
class JunkSpec extends TestKit(ActorSystem("test")) with FlatSpec with ShouldMatchers {
val junkRef = TestActorRef[Junk]
val junk = junkRef.underlyingActor
"The colour" should "be Blue" in {
junkRef ! "blah"
junk.colour should be ("Blue")
}
}
class Junk(num:Int) extends Actor {
val log = Logging(context.system,this)
def colour = "Blue"
def receive = {
case msg => println("blah")
}
}
object Junk {
val config = ConfigFactory.load()
val system = ActorSystem("system", config)
val junk = system.actorOf((Props(new Junk(10))),"junk")
}
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/ZE7UnnaBE94J.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Hi Bruce,You didn't change: val junkRef = TestActorRef[Junk]That'll try to create the Junk without any constructor parameters, but you have no default constructor in Junk anymore and therefor it goes bye-bye.Cheers,√