Zurück zu Willert.de

Query current state

Query current state

Postby stevzie » July 13th, 2010, 6:42 pm

Is there a way to in a coded test case to ask the current state of a state chart?

I know how to check if I'm in a specific state:

RTC_ASSERT_NAME("Disengaged", this->itsModeLogic.IS_IN(Disengaged));

I don't know how to simply obtain the current state.
Posts: 2
Joined: June 12th, 2009, 4:01 pm

Re: Query current state

Postby KalleBlaschke » July 14th, 2010, 8:54 am

Hi stevzie,

by default Rhapsody generates int variables (like rootstate_substate, rootstate_active) which are
protected in order to store the current states. If you want to have direct access to these state variables
you can add an operation to your class containing the statechart that returns the values of these variables,

int getCurrentState() { return rootstate_active; }

However, please be aware that in general more than one state is active, and that Rhapsody uses several
variables to store the current state, so make sure you are querying the relevant variables.
Posts: 12
Joined: January 25th, 2010, 1:40 pm

Return to TestConductor, ATG, Gateway, ReporterPlus

Who is online

Users browsing this forum: No registered users and 2 guests