Ast 09
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Ast 09

on

  • 301 views

 

Statistics

Views

Total Views
301
Views on SlideShare
301
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Ast 09 Presentation Transcript

  • 1. Model Based Functional Testing using Pattern Directed Filmstrips
    Tony Clark
    Centre for Model Driven Software Engineering
    Thames Valley University
    tony.clark@tvu.ac.uk
    1
  • 2. Overview
    Industry likes using models.
    Tests as part of requirements is a good idea.
    Industry does not like scary stuff.
    Can modelling:
    Incorporate testing.
    Make tests more diagrammatic.
    Be more exemplar-based.
    Do more stuff with use cases.
    2
  • 3. Example Model
    3
  • 4. Behaviour
    4
  • 5. Testing Behaviour – Wood from Trees
    class TestSalesSystem extends TestCase {
    private s = new SalesSystem();
    public void testAddContact() {
    String name = “fredjones”;
    s.contact(name);
    boolean added = false;
    for(Person p : s.contactsDB().getPeople())
    if(p.getCID().equals(name))
    added = true;
    AssertTrue(name + “ not added”,added);
    }
    ...
    }
    5
  • 6. Testing Behaviour – Scary!
    context SalesSystem::contact(name:String)
    pre:
    not contactsDB.people->exists(p | p.name = name)
    post:
    contactsDB.people->exists(p | p.name = name)
    6
  • 7. Model Driven Testing
    7
  • 8. Filmstrip Specification
    8
  • 9. Snapshots: AccountsHaveCustomers
    snapshotAccountsHaveCustomers {object:SalesSystem { accounts = object:AccountsSystem { accounts forall {rootobject:Account { cid = ?cobject ?o:Customer {
    cid = ?c } }
    }
    orderSystem =object:OrderSystem { customers exists {root?o:Customer { } object } }}
    9
  • 10. Language – Text matches Graphics
    F ::= let V = S in F local defs | always S { F } invariants | F F sequences | F* repetition | step Op pre S post S steps
    Op ::= V(E*) operations
    S ::= S and S logical and | S or S logical or | not S logical not | S[V/V] renaming | snapshot B snapshots
    B ::= { ([root]O)* } object sets
    O ::= object [V]:T { (Q|F)* } objects
    Q ::= V (forall | exists) B quantification
    F ::= V (= | <>) E slots
    E ::= V | Int | Str | Bool | O values
    10
  • 11. Example
    letAccountsHaveCustomers = ...UniqueIds = ...
    inalwaysAccountsHaveCustomersandUniqueIds {
    (step contact(?id:String)pre snapshot {rootobject:SalesSystem {contactsDB = object:ContactsDB { people forall {rootobject:Person { cid <> ?id } } } }
    postsnapshot {rootobject:SalesSystem {contactsDB =object:ContactsDB {
    people exists {rootobject:Person { cid = ?id } } } } ... ship, register and placeOrder)*}
    11
  • 12. Demonstration
    DSL for testing in XMF
    Run against SalesSystem in Java
    Caveats:
    Filmstrip language
    OCL for snapshots (not this demo)
    No implementation mapping.
    12
  • 13. Conclusion
    Extend UML for model based testing:
    Filmstrips (based on use cases)
    Snapshot patterns (based on object models)
    Semantics: sequences of object models.
    Testing:
    Generate candidate filmstrips
    Run against SUT (after implementation mapping)
    13