Introduction

SCXML, short for State Chart XML, is a statechart interchange format. It is based on XML and has been standardized by the W3C. This standardization makes statecharts highly portable and independent of a particular implementation. The prerequisite is of course that the respective execution environment corresponds to the SCXML specification.

The current version of the specification was released by the W3C in September 2015. A “hello world” in SCXML looks like this:

<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="hello">
  <final id="hello">
    <onentry>
      <log expr="'hello world'" />
    </onentry>
  </final>
</scxml>

The XML defines all the states, transitions, events and variables used in the state machine. Besides the state machine’s structural elements, the SCXML standard also defines the execution semantics of that state machine. And this is one of the biggest advantages of SCXML – the same statechart model can run on different SCXML engines on different platforms and it always behaves in exactly the same way – as long as the engines conform to the specified execution semantics.

SCXML is supported on nearly all platforms. For Java, Apache Commons SCXML is the most popular SCXML Engine. There are even SCXML engines written in JavaScript to be used in web applications, like SCION. Another very popular platform that uses SCXML for Human Machine Interfaces is the SCXML Interpreter for Qt.

To use the SCXML domain, just select it on the domain selection page when creating a new statechart. Alternatively, you can select it in the statechart’s property view. When using the SCXML domain, everything will by fully compliant with the SCXML standard. We adapted the built-in simulation engine to reflect the SCXML execution semantics, and of course the SCTUnit framework also supports the SCXML standard. Thus, you can be sure that your SCTUnit test results exactly reflect the behavior of the SCXML engine of your choice.