I am trying to test a TypedActor with akka-http and have issues while trying to create a Test case. For testing a TypedActor, I would write the following Spec...
class MyServiceTestSpec extends ScalaTestWithActorTestKit with FlatSpecLike with Matchers
But, when I would have to write a TypedActor used with HTTP /+ WS route, I am unable to write...
class MyHTTPServiceTestSpec extends ScalaTestWithActorTestKit with FlatSpecLike with Matchers with ScalatestRouteTest
This is because system
member for ScalaTestWithActorTestKit
is a typed.ActorSystem, while for ScalatestRouteTest is ActorSystem
(untyped).
How would I be able to write a test that can use both?
Please advice.
There's currently no way to do that out of the box, you will have to introduce some glue like the ScalaTestWithActorTestKit
and ActorTestKitBase
in your own test sources for now. There's an issue tracking improving on the situation here: https://github.com/akka/akka-http/issues/2036