Talk: João Pascoal Faria
Automating Interaction Testing with UML Sequence Diagrams: Where TDD and UML meet
João Pascoal Faria, FEUP
Friday, Jun 25, 13:30 – 15:00 @ B 002
The development of computer-based UML design models for documentation only is time consuming and the result is often wrong and soon becomes outdated. But if the UML models are used also as a basis for automatic code generation and/or test generation, then the time invested can be recovered, the quality of the models can be checked and improved, and there is a good chance that they are kept up-to-date.
In this talk it will be presented an approach and supporting tools for constructing executable UML design models in an agile way. The structural/static aspects of the system are modeled through class diagrams, from which class skeletons are automatically generated using already existing tools. The novelty of the approach has to do with the dynamic modeling. The dynamic behavior of the system is incrementally specified/modeled through sequence diagrams that act simultaneously as test scenarios. From these scenarios, unit tests (in fact, interaction tests) are automatically generated. The test code generated not only checks the results returned, but also checks that internal interactions among objects in the system occur as specified in the sequence diagrams.
To demonstrate and support the approach, it was developed a plug-in for Enterprise Architect (a leading UML modeling tool) that generates JUnit tests from test scenarios specified as UML sequence diagrams. It was also developed a test helper framework in AspectJ that traces the actual interactions among objects that occur at run-time, and checks if they are a supertree of the interactions specified in the sequence diagram (and coded into the test code).
This approach can be used iteratively as in test-driven development, achieving a true integration between agile modeling and TDD.