Monday, May 7, 2018

Akka.NET–Testing the exceptional flow

We are currently building an actor based system using Akka.NET. Creating the system itself is a breeze thanks to Akka.NET, but the introduction of the actor model and actors makes testing somewhat harder.

The scenario we struggled the most with is when an Actor executes a task but reports no message back. In that case we don’t know what happened inside the actor itself making it hard to assert what is going on. Anyway today I wanted to talk about another scenario; how to test if an Actor throws an Exception.

I couldn’t find a good example that showed how to handle this test case, so here is how we do it(any feedback is welcome):

Remark: We are using NUnit in combination with Akka.TestKit.NUnit.

No comments: