ICONIX Software Engineering, Inc.  
Design-Driven Testing using the Agile/ICONIX Add-In

TRAINING and CONSULTING
  UML JumpStart Training
  JumpStart with EA
  Hands on ICONIX Process
(Onsite or Open Enrollment)
  Request Training Info
MULTIMEDIA TUTORIALS
  EA for Power Users
  Mastering UML w/ICONIX Process
  EA TrainingPack
  SHOPPING CART
PRODUCTS
  Enterprise Architect
  MDG Integration for Eclipse
  MDG Integration for Visual Studio
  SHOPPING CART
PRODUCT BUNDLES
  PowerPack/Corporate
  PowerPack/Developer
  PowerPack/Business
BOOKS
  Use Case Driven Object Modeling - Theory and Practice
  Agile Dev. with ICONIX Process
  Extreme Programming Refactored
ARTICLES
  Designing LSST with EA
  DMV Case Study
FUNNY STUFF
  Song of the Extremos (Humor)
  Alice in Use Case Land (Humor)

PRODUCT BUNDLES
CONTACT
SHOPPING CART

Doug Rosenberg, ICONIX

Matt Stephens, Software Reality

Aaron Bell, Tom O’Reilly, Sparx Systems

 

 

ICONIX and Sparx Systems have collaborated on the production of a new Add-In that extends the functionality of Enterprise Architect to support Design-Driven Testing (DDT).  DDT (also known as ICONIX Process for Test) will be described more completely in an upcoming book by Doug Rosenberg and Matt Stephens.  This article describes how to use the Agile/ICONIX add-in to drive test code from UML models.

 

Let’s consider a simple Login use case, which satisfies 3 Requirements.

 

 

We can automatically generate a Robustness Diagram using the add-in, by selecting the use case and choosing the Agile/ICONIX add-in from the Add-In menu:

 

 

The add-in creates a new Robustness diagram under the use case in the Project Browser, and propagates the Requirements (if desired) onto the Robustness Diagram.

 

 

In addition to propagating the Requirements, the add-in creates a new Note on the Robustness diagram that is hot-linked to the use case text.

 

 

Having the Requirements on the Robustness diagram helps us to make sure we haven’t forgotten any Requirements as we analyze the use case.

 

 

By analyzing our use case using the Robustness Analysis technique, we’ve added a lot of information to the model that can be used to drive the testing of the application.  To begin with, our add-in can automatically generate test cases for each “controller” on the Robustness diagram.

 

 

We can also choose to generate test cases for our Requirements. 

 

In some organizations, the development team might own the “controller tests” while an independent QA team might own the “requirement tests”.  We can also generate test cases for messages on Sequence diagrams.

 

Once we’ve generated the test cases, we can add Scenarios using Enterprise Architect’s “Testing View”.  In this example shown, we’re adding scenarios to the test case that validates the format of a password.  We need to check that the password is of the required length, contains a mix of alpha and numeric characters, and is a mix of upper and lower case.

 

 

We can easily generate test plan reports using Enterprise Architect’s built-in report generation capability. So driving our testing activity from the model is very straightforward.

 

Even if the add-in did nothing more than what’s been shown so far, it would still be extremely useful.  But there’s significantly more capability ahead.  Sparx Systems has developed automatic Transforms between test cases and test classes.  Transforms exist for widely used unit testing frameworks JUnit (for Java) and NUnit (for .Net).

 

When we transform our test case using the ICONIX JUnit transform, “setup()” and “tearDown()” methods are added automatically, and a test method is created for each scenario.  This transformation, originally envisioned by Matt Stephens while we were writing the book “Agile Development with ICONIX Process[1]”, and implemented by Sparx Systems, is the essence of the Design-Driven Testing approach.

 

 

Once the test cases have been transformed to test classes, they can be code-generated, using Enterprise Architect’s standard code-generation techniques.

 

 

NUnit test classes can be generated in a variety of languages; the example shown is a JUnit test class, code generated in Java.

 

 

In addition to being useful during Requirements definition and Analysis/Conceptual Design phases of a project, the Agile/ICONIX add-in also delivers value when transitioning from the Analysis phase to Detailed Design, by automatically generating skeleton Sequence diagrams from Robustness Diagrams.

 

 

The add-in automatically creates a new sequence diagram, and brings a “hot-linked” note, and all Boundary and Entity objects from the Robustness diagram onto the Sequence diagram.  Developers then complete the design of the use case on the Sequence diagram.

 

 

Once the Sequence diagram is completed, the Add-in is used to generate unit tests from the messages on the Sequence Diagram.  Note that “controllers” on Robustness diagrams tend to reflect a slightly higher abstraction level than Sequence messages; that is, a controller may be implemented as multiple messages on a Sequence diagram.

 

Using the DDT process, we have the flexibility to test against Requirements, against Controllers (“logical functions”) and to do true unit testing at the Sequence message level.  All of these abstraction levels should be verified by our testing.

 

Thus the Add-in delivers value during the Requirements, Analysis, and Design phases of the lifecycle, and automates the process of driving test plans and test code directly from the models.

 

 

 

 

The Agile/ICONIX add-in enables a systematic approach to software development that drives tests from a UML-based design.  The authors believe this approach offers significant advantages over “Test-Driven Development”, where the “design” is driven by unit-testing.

 

 

 

 

 

 

ICONIX Software Engineering, Inc.
10642 Santa Monica Blvd, Suite 200, Los Angeles, CA 90025
Tel (310) 474-8482 / Fax (310) 474-8609
email: UMLTraining@iconixsw.com