You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Akka's test kit presents a reasonable set of tools for interrogating messages between actors, however, does not much in the way of capturing and asserting on the state changes within a single actor. Either Akka believes that only black-box testing should be performed or else that actors should decomposed into much smaller parts (e.g. shrinking the black box for each to the point it's almost grey).
Regardless, what we need is an test actor wrapper (TAW) that accepts a reference to the actor under test (AUT) such that when the AUT sends a message to itself it goes to the TAW. The programmer is able to register matching-predicates (much like normal actor message processing) to interrogate and asset on the message. These assertions can: 1) ensure the correct message is received; 2) transition the TAW to a different state to inform expectations of the next message or final state. Assuming the predicate does not throw (e.g. assertion failure) the TAW then forwards the message to the AUT.
Any exceptions thrown by programmer defined predicates on the TAW must be captured by the TAW. At the end of the test the programmer should "assert" on the TAW which will either pass or fail depending on: 1) whether any exceptions where thrown by predicates; 2) on custom logic asserting on the final state of the TAW and/or AUT.
Such a construct would help simplify and improve the quality of the upcoming tests in Metrics Portal where we are currently simply overriding the getSelf() method.
The text was updated successfully, but these errors were encountered:
Akka's test kit presents a reasonable set of tools for interrogating messages between actors, however, does not much in the way of capturing and asserting on the state changes within a single actor. Either Akka believes that only black-box testing should be performed or else that actors should decomposed into much smaller parts (e.g. shrinking the black box for each to the point it's almost grey).
Regardless, what we need is an test actor wrapper (TAW) that accepts a reference to the actor under test (AUT) such that when the AUT sends a message to itself it goes to the TAW. The programmer is able to register matching-predicates (much like normal actor message processing) to interrogate and asset on the message. These assertions can: 1) ensure the correct message is received; 2) transition the TAW to a different state to inform expectations of the next message or final state. Assuming the predicate does not throw (e.g. assertion failure) the TAW then forwards the message to the AUT.
Any exceptions thrown by programmer defined predicates on the TAW must be captured by the TAW. At the end of the test the programmer should "assert" on the TAW which will either pass or fail depending on: 1) whether any exceptions where thrown by predicates; 2) on custom logic asserting on the final state of the TAW and/or AUT.
Such a construct would help simplify and improve the quality of the upcoming tests in Metrics Portal where we are currently simply overriding the
getSelf()
method.The text was updated successfully, but these errors were encountered: