Your SlideShare is downloading. ×
White-box texting of (ATL) model transformations
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

White-box texting of (ATL) model transformations

581
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
581
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. ATLTestA White-Box test generation approach for ATL transformations Carlos A. González and Jordi Cabot © AtlanMod - atlanmod-contact@mines-nantes.fr 1
  • 2. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 2
  • 3. White-Box Testing Techniques Control Flow Graph / Data Flow Graph © AtlanMod - atlanmod-contact@mines-nantes.fr 3
  • 4. White-Box Testing Techniques Control Flow Graph / Data Flow Graph White-Box Testing Criterion © AtlanMod - atlanmod-contact@mines-nantes.fr 4
  • 5. White-Box Testing Techniques: An Exampleif (A and B) { … if (C or D) { … }} Control Flow Graphelse { … if (C and D) { A and B A and B … true false }}… C or D C or D C and D C and D true false false … true © AtlanMod - atlanmod-contact@mines-nantes.fr 5
  • 6. White-Box Testing Techniques: An Exampleif (A and B) { Decision Analysis … if (C or D) { A … , A } B ,} Control Flow Graph ¬ , Belse { A ¬ C , … , A if (C and D) { A and B A and B ¬ MultiDecision Analysis ¬ , … true false A, B, C,C B ¬D A, ¬ B, C, D } ,} A, B, ¬ , D B C, ¬ A, ¬ B, ¬ C, D… C or D C or D C and D C and D ¬ , A, B, C,D D C ¬ A, ¬ B, C, ¬ D C true false false … true A, B, ¬ , ¬ D A, ¬ B, ¬ C, ¬ D C, ¬ A, B, D D C, ¬ A, ¬ B, C, ¬ A, B, ¬ C, D D A, ¬ B, ¬ C, D ¬ ¬ A, B, C, ¬ D ¬ A, ¬ B, C, ¬ D ¬ A, B, ¬ C, ¬ D ¬ A, ¬ B, ¬ C, ¬ D © AtlanMod - atlanmod-contact@mines-nantes.fr 6
  • 7. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 7
  • 8. ATLTest: Overall Picture © AtlanMod - atlanmod-contact@mines-nantes.fr 8
  • 9. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 9
  • 10. ATLTest: Model Transformation Analysismodule Publication2Book;create OUT : Book from IN : Publication; Source Modelrule Publication2Book { from p: Publication!Publication (p.isBook) to b: Book!Book ( title<-p.title, isMultiVolume<-p.sections->select(s| s.isChapter)-> size()>25 and p.sections->select(s| s.isTOC)->size()>2, chapters<-p.sections->select(s| s.isChapter), nPages<-p.sections->collect(s| s.nPages)->sum() )} Target Modelrule PubSection2Chapter { from ps: Publication!PubSection (ps.isChapter) to c: Book!Chapter ( title<-ps.title )} © AtlanMod - atlanmod-contact@mines-nantes.fr 10
  • 11. ATLTest: Model Transformation Analysismodule Publication2Book;create OUT : Book from IN : Publication; Source Modelrule Publication2Book { from p: Publication!Publication (p.isBook) to b: Book!Book ( title<-p.title, isMultiVolume<-p.sections->select(s| s.isChapter)-> size()>25 and p.sections->select(s| s.isTOC)->size()>2, chapters<-p.sections->select(s| s.isChapter), nPages<-p.sections->collect(s| s.nPages)->sum() )} Target Modelrule PubSection2Chapter { from ps: Publication!PubSection (ps.isChapter) to c: Book!Chapter ( title<-ps.title )} © AtlanMod - atlanmod-contact@mines-nantes.fr 11
  • 12. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 12
  • 13. ATLTest: Dependency Graph Generation chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test cases to cover... the presence/absence of “Publication” elements with no “sections” in the input model? the presence/absence of “PubSection” elements where the “isChapter” flag is set to true? © AtlanMod - atlanmod-contact@mines-nantes.fr 13
  • 14. ATLTest: Dependency Graph Generation chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test cases to cover... the presence/absence of “Publication” elements with no “sections” in the input model? Publication::allInstances()->select(p| p.sections->notEmpty())->notEmpty() 88 the presence/absence of “PubSection” elements where the “isChapter” flag is set to true? PubSection::allInstances()->select(s| s.isChapter)->notEmpty() 99 © AtlanMod - atlanmod-contact@mines-nantes.fr 14
  • 15. ATLTest: Dependency Graph Generation chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test cases to cover... the presence/absence of “Publication” elements with no “sections” in the input model? Publication::allInstances()->select(p| p.sections->notEmpty())->notEmpty() 88 the presence/absence of “PubSection” elements where the “isChapter” flag is set to true? PubSection::allInstances()->select(s| s.isChapter)->notEmpty() 99 But the input model cannot include at the same time“Publication” elements with no sections and “PubSection”elements with the “isChapter” flag set to true... © AtlanMod - atlanmod-contact@mines-nantes.fr 15
  • 16. ATLTest: Dependency Graph Generation chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test cases to cover... the presence/absence of “Publication” elements with no “sections” in the input model? Publication::allInstances()->select(p| p.sections->notEmpty())->notEmpty() 88 the presence/absence of “PubSection” elements where the “isChapter” flag is set to true? PubSection::allInstances()->select(s| s.isChapter)->notEmpty() 99 But the input model cannot include at the same time Dependency Graph“Publication” elements with no sections and “PubSection” 88 99elements with the “isChapter” flag set to true... © AtlanMod - atlanmod-contact@mines-nantes.fr 16
  • 17. ATLTest: Dependency Graph Generation © AtlanMod - atlanmod-contact@mines-nantes.fr 17
  • 18. ATLTest: Dependency Graph Generation © AtlanMod - atlanmod-contact@mines-nantes.fr 18
  • 19. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 19
  • 20. ATLTest: Graph Traversal Traversing the graph consists in assigning truth values to the OCL expressions in the nodes, so that for each visited node... – The whole OCL expression is set to a truth value (Condition coverage) – Each OCL subexpression is set to a truth value (Multicondition coverage) A branch traversal finishes when the OCL expression in a given node evaluates to “false”, that is, when... – The whole OCL expression is set to “false” (Condition coverage) – The combination of truth values assigned to each subexpression causes the whole OCL expression to be “false © AtlanMod - atlanmod-contact@mines-nantes.fr 20
  • 21. ATLTest: Graph Traversal Each graph traversal yields a set of OCL expressions equalized to a truth value Each one of these sets of OCL expressions caracterizes a test case In other words, each set of OCL expressions represents the conditions the prospective test case must hold. © AtlanMod - atlanmod-contact@mines-nantes.fr 21
  • 22. ATLTest: Graph Traversal (Condition Cov.) © AtlanMod - atlanmod-contact@mines-nantes.fr 22
  • 23. ATLTest: Graph Traversal (Condition Cov.) =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE =TRUE © AtlanMod - atlanmod-contact@mines-nantes.fr 23
  • 24. ATLTest: Graph Traversal (Condition Cov.) Publication::allInstances()->notEmpty()=true Publication::allInstances()->select(p|p.isBook)->notEmpty()=true Publication::allInstances()->select(p|p.sections->notEmpty())->notEmpty()=true PubSection::allInstances()->select(s|s.isChapter)->notEmpty()=true Publication::allInstances()->select(p|p.sections->notEmpty())->notEmpty()=true PubSection::allInstances()->select(s|s.isTOC)->notEmpty()=true Publication::allInstances()->select(p|p.sections->select(s|s.isChapter)->size()>25) ->notEmpty() and Publication::allInstances()->select(p|p.sections ->select(s|s.isTOC)->size()>2)->notEmpty()=true PubSection::allInstances()->notEmpty()=true PubSection::allInstances()->select(s|s.isChapter)->notEmpty()=true © AtlanMod - atlanmod-contact@mines-nantes.fr 24
  • 25. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 25
  • 26. ATLTest: Generating Test Cases EMFtoCSP1 checks whether is possible or not to create a valid instance of a given (meta)model1 EMFtoCSP is a separate tool developed by the AtlanMod team, available as part ofthe Eclipse Labs innitiative at http://code.google.com/a/eclipselabs.org/p/emftocsp/ © AtlanMod - atlanmod-contact@mines-nantes.fr 26
  • 27. ATLTest: Generating Test CasesApplying EMFtoCSP over the sourcemetamodel and the constraints obtainedbefore....Publication::allInstances()->notEmpty()=truePublication::allInstances()->select(p|p.isBook)->notEmpty()=truePublication::allInstances()->select(p|p.sections->notEmpty())->notEmpty()=truePubSection::allInstances()->select(s|s.isChapter)->notEmpty()=truePublication::allInstances()->select(p|p.sections->notEmpty())->notEmpty()=truePubSection::allInstances()->select(s|s.isTOC)->notEmpty()=truePublication::allInstances()->select(p|p.sections->select(s|s.isChapter)->size()>25) ->notEmpty() and Publication::allInstances()->select(p|p.sections ->select(s|s.isTOC)->size()>2)->notEmpty()=truePubSection::allInstances()->notEmpty()=truePubSection::allInstances()->select(s|s.isChapter)->notEmpty()=true © AtlanMod - atlanmod-contact@mines-nantes.fr 27
  • 28. ATLTest: Generating Test Cases...the following test case is yielded PublicationSection3 ... PublicationSection25 © AtlanMod - atlanmod-contact@mines-nantes.fr 28
  • 29. Index1. Some backgroung on white-box testing2. ATLTest: a) Overall picture b) Model transformation analysis c) Dependency graph generation d) Dependency graph traversal e) Test case generation2. Future work © AtlanMod - atlanmod-contact@mines-nantes.fr 29
  • 30. ATLTest: Future Work Extending the approach to QVTr Improve the graph generation process to avoid the presence of nodes with the same OCL expression Complete the integration of the different components that made up ATLTest ATLTest is a first step in the development of a model transformation testing framework in which ATLTest and other model transformation testing innitiatives from the community can be combined © AtlanMod - atlanmod-contact@mines-nantes.fr 30
  • 31. Thank you!Questions? © AtlanMod - atlanmod-contact@mines-nantes.fr 31