Visual FlexUnit UML Diagrams

January 8th, 2008

Here are a few UML (Unified Modeling Language) diagrams that show a bit about how Visual FlexUnit works.

All are simplified to enhance clarity.

This post is intended to complement my Highlights of Visual FlexUnit’s Code post.

1. TestCase Classes

When you use VFU to write visual tests you subclass VfuTestCase rather than TestCase. But VfuTestCase is a subclass of TestCase, so you still have access to all the standard TestCase functionality. This diagram shows an example test class, VfuExampleTests, which is included in the VFU download, and its two superclasses.

Also, note that VfuTestCase uses a TestSequenceManager instance. We’ll look more closely at this shortly.

test_case_classes

2. TestSequenceManager & the TestSequenceCommand Classes

VFU uses the classic Command design pattern…

TestSequenceManager has an array holding zero to many TestSequenceCommand instances. All TestSequenceCommand instances also hold a reference to TestSequenceManager so that they can make calls back to it, including its commandFinished() method.

test_sequence_classes

3. Sequence Diagram for TestSequenceManager & Some TestSequenceCommand Classes

Before we look at the sequence diagram, heres a sample visual test method from the VFU docs:

vfu_example_test_method

Note that we call multiple add…() methods in VfuTestCase.testSequence – its TestSequenceManager instance – then we call its start() method.

This sequence diagram is a simplified depiction of what happens when a very simple test method is run, on with just two add…() calls. Most add…() calls to TestSequenceManager create and add a singleTestSequenceCommand instance to its _testSequence array. The addAssertComponentMatchBaseline() call does this, as shown below. The addRefresh() method is unusual in that it creates and adds three. Once all TestSequenceCommands are created the manager starts to execute them.

vfu_manager_and_command_sequence

5 Responses to “Visual FlexUnit UML Diagrams”

  1. Todd Says:

    Hey Douglas, This VisualUnit testing stuff you’ve been working on looks really interesting. I’m going to have to check it out. BTW, what software did you use to create the sequence and model diagrams (was it something other than Visio?) Thanks.

  2. Douglas McCarroll Says:

    Hi Todd,

    Enterprise Architect:

    http://www.sparxsystems.com.au/

    Great program, though not inexpensive.

    Douglas

  3. sharath Says:

    how can we execute the UML diagrams??

    that means
    if we draw an UML diagram ,can we execute it …..
    can we get the code from that diagram???

    plzzzzzzz reply

  4. Douglas McCarroll Says:

    Sharath,

    If you get the Professional version of Enterprise Architect, it will both create diagrams from existing code and create code from diagrams. But the exported code will only be stub code, so there won’t be much to execute.

    And it’s fairly expensive. But you can play with it for 30 days for free. :)

    Douglas

  5. Mark Lapasa Says:

    Great post. Re: UML editors. I found Violet UML to be a poor-man’s alternative to EA. Although EA is the best tool I’ve used. Diagrams are only as good to the extent of the ability of your collaborators’ understanding of them.

    So I haven’t shelled out the cash =)

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word