boost statechart, unit-testing fraction of a state-machine

456 Views Asked by At

I'm looking for a way to execute (for unit-testing purposes) only fractions of a complex state -machine. For that purpose I'm evaluating boost::statechart framework.

One way that I considered was to design a hierarchical state machine, where each state is defined as a nested state-machine, that should be tested separately.

Consider the FSM definition from the following code snippet:

struct Fsm: boost::statechart::state_machine< Fsm, StateA >
{
  ...
}

struct StatA : boost::simple_state< StateA, Fsm, StateA1 >
{
  ...
}

struct StateB : boost::simple_state< StateB, Fsm, StateB1 >  
{
  ....
}

struct StateA1 : boost::simple_state< StateA1, StateA >
{
  ....
}

struct StateA2 : boost::simple_state< StateA2, StateA >
{
  ....
}

struct StateB1 : boost::simple_state< StateB1, StateB >  
{
  ....
}

struct StateB2 : boost::simple_state< StateB2, StateB >  
{
  ....
}

Is it possible to unit-test the logic defined inside state B i.e. B1 and B2 inner states, without executing or even compiling the logic defined for state A including its inner A1 and A2 states?

Thanks in advance, AmirH

0

There are 0 best solutions below