Model Based Functional Testing using Pattern Directed Filmstrips<br />Tony Clark<br />Centre for Model Driven Software Eng...
Overview<br />Industry likes using models.<br />Tests as part of requirements is a good idea.<br />Industry does not like ...
Example Model<br />3<br />
Behaviour<br />4<br />
Testing Behaviour – Wood from Trees<br />class TestSalesSystem extends TestCase {<br />  private s = new SalesSystem();<br...
Testing Behaviour – Scary!<br />context SalesSystem::contact(name:String)<br />  pre: <br />    not contactsDB.people->exi...
Model Driven Testing<br />7<br />
Filmstrip Specification<br />8<br />
Snapshots: AccountsHaveCustomers<br />snapshotAccountsHaveCustomers {object:SalesSystem {    accounts = object:AccountsSys...
Language – Text matches Graphics<br />F ::= let V = S in F               local defs |  always S { F }               invari...
Example<br />letAccountsHaveCustomers = ...UniqueIds = ...<br />inalwaysAccountsHaveCustomersandUniqueIds {<br />     (ste...
Demonstration<br />DSL for testing in XMF<br />Run against SalesSystem in Java<br />Caveats:<br />Filmstrip language<br />...
Conclusion<br />Extend UML for model based testing:<br />Filmstrips (based on use cases)<br />Snapshot patterns (based on ...
Upcoming SlideShare
Loading in …5
×

Ast 09

393 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
393
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ast 09

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

×