Test First Modeling

There are some obvious similarities between UML models and code that can exploited in model verification. TestFirstModeling applies TestFirstDesign to UML models.

You start by defining a test case. Test cases can be modeled as two object diagrams that show the initial conditions of the test and the final system state. A test assertion is applied to the end state - possibly written in OCL or another precise specification language (eg, Object Z). The "test driver" can be modeled as a sequence diagram that calls one or more operations on the model element under test (MEUT). At this point your model is not well-formed because you should not have modeled the required model features to pass the test. To make your model well-formed you must define the structural elements required for the test. After you have done this your model should be well-formed. You then execute your test by simulating the execution of the model. In Catalysis, this can be done using filmsrtips (a sequence of object diagrams) which are updated with each step in the test. Assertions can optionally be applied during execution (eg, invariants). At the end, the actual test assertion is applied against the resulting object diagram which shows the system end state.

Currently no UML tools support model testing, though some vendors are actively evaluating mechanisms for executing OCL queries against object diagrams and for executing scripts that animate object diagrams based on sequence diagrams + extra behavioural instructions. The USE tool gives some impression of how this might be achieved, but is generally too fiddly for production use (http://www.db.informatik.uni-bremen.de/projects/USE/)

The germ of this idea can be found in http://www.objectmonkey.com/dev/index.php?action=get_resources&search=&category=2&page=1&filter=yes in the article entitled "Test-first Modeling".

-- JasonGorman


CategoryModels


EditText of this page (last edited December 4, 2014) or FindPage with title or text search