How, if at all, do you write negative unit tests for an FSM?

by Stijn   Last Updated October 04, 2017 14:05 PM

I've written my first FSM in Akka.NET, and now I want to write unit tests for it. I've already read about TestFSMRef, which lets you set up the initial state and write positive unit tests, e.g. in state X, the FSM should handle messages A and B.

Should I write negative unit tests, e.g. in state Y, the actor should not handle messages A and B, or anything else that it isn't defined to handle? If so, how? I'm reluctant to write such tests because it feels like their could quickly grow out of control, but at the same time I also feel like I'd only be partially testing the FSM.



Related Questions



State Design Pattern

Updated July 05, 2016 08:02 AM



State machine with additional variable

Updated September 07, 2016 09:02 AM