4 Akka test kit

 

This chapter covers

  • Testing actors with the Akka test kit
  • Testing synchronous scenarios
  • Testing asynchronous scenarios

When testing is limited to a single component, anyone can test quickly but when testing includes integrations, ease and speed are usually quickly lost. Actors provide an interesting solution to this problem for the following reasons:

  • Actors fit Behavior Driven Development because they embody behavior as a fundamental primitive.
  • Actors come in systems and are therefore fundamentally built on integration.
  • Too often, regular unit tests only test the interface, or they have to test the interface and functionality separately.
  • Actors are based on messaging, which has huge advantages for testing because you can simulate certain behaviors by simply sending the messages.

In this chapter you will learn two different methods for testing actors. On the one hand, you will learn how to stub actor systems to test actors in isolation and with deterministic guarantees. On the other hand, you will test Actors in a real-world context where multiple Actors interact with each other and messages arrive in indeterminate order. Accordingly, you will learn testing in synchronous and asynchronous settings.

4.1 Sync testing

 
 
 

4.1.1 Effects

 
 

4.1.2 More than one actor

 
 
 

4.1.3 Testing the logs

 
 
 
 

4.2 Async Testing

 
 

4.2.1 Using probes

 
 
 

4.2.2 Logging

 
 

4.2.3 Monitoring

 

4.2.4 Fishing messages

 
 
 

4.2.5 Log Capturing

 

4.3 Summary

 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest