Monday, November 7, 2016

Unit testing Microsoft Orleans

Unit testing your Orleans actors in isolation is not easy. The problem is that they all have to inherit from a Grain or Grain<T> base class. This class has a lot of properties that you probably are using during the lifetime of your actor(e.g. accessing state, writing state, using the GrainFactory to talk to other actors,…)

I first tried to avoid the unit testing problem by focussing more on integration testing and using the TestingSiloHost but the need to test some functionality in isolation remained. Time for a better solution…

I searched around on the web to see how other people tackled this issue. Some falled back to mocking frameworks but it didn’t help to make the tests more readible. In the end I ended on a simple approach where we use some simple composition and extract the real actor logic into a separate class:

1 comment:

Software Development Company said...

The Article on Unit testing Microsoft Orleans is very informative. It give detail information about it .Thanks for Sharing the information on Unit Testing Orlema.
Software Testing Company