ATLTestA White-Box test generation approach       for ATL transformations                             Carlos A. González a...
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
White-Box Testing Techniques       Control Flow Graph / Data Flow Graph         © AtlanMod - atlanmod-contact@mines-nantes...
White-Box Testing Techniques       Control Flow Graph / Data Flow Graph                     White-Box                  Tes...
White-Box Testing Techniques: An Exampleif (A and B) {  …  if (C or D) {    …  }}                       Control Flow Graph...
White-Box Testing Techniques: An Exampleif (A and B) {                                                                   D...
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Overall Picture     © AtlanMod - atlanmod-contact@mines-nantes.fr   8
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Model Transformation Analysismodule Publication2Book;create OUT : Book from IN : Publication;                    ...
ATLTest: Model Transformation Analysismodule Publication2Book;create OUT : Book from IN : Publication;                    ...
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Dependency Graph Generation  chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test case...
ATLTest: Dependency Graph Generation  chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test case...
ATLTest: Dependency Graph Generation  chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test case...
ATLTest: Dependency Graph Generation  chapters<-p.sections->select(s| s.isChapter)Wouldn’t it be nice generating test case...
ATLTest: Dependency Graph Generation            © AtlanMod - atlanmod-contact@mines-nantes.fr   17
ATLTest: Dependency Graph Generation            © AtlanMod - atlanmod-contact@mines-nantes.fr   18
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Graph Traversal Traversing the graph consists in assigning truth values  to the OCL expressions in the nodes, so...
ATLTest: Graph Traversal Each graph traversal yields a set of OCL  expressions equalized to a truth value Each one of th...
ATLTest: Graph Traversal (Condition Cov.)              © AtlanMod - atlanmod-contact@mines-nantes.fr   22
ATLTest: Graph Traversal (Condition Cov.)               =TRUE                                              =TRUE          ...
ATLTest: Graph Traversal (Condition Cov.) Publication::allInstances()->notEmpty()=true Publication::allInstances()->select...
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Generating Test Cases EMFtoCSP1 checks whether is  possible or not to create a valid  instance of a given (meta)...
ATLTest: Generating Test CasesApplying EMFtoCSP over the sourcemetamodel and the constraints obtainedbefore....Publication...
ATLTest: Generating Test Cases...the following test case is yielded                              PublicationSection3 ... P...
Index1.   Some backgroung on white-box testing2.   ATLTest: a) Overall picture              b) Model transformation analys...
ATLTest: Future Work Extending the approach to QVTr Improve the graph generation process to avoid  the presence of nodes...
Thank you!Questions? © AtlanMod - atlanmod-contact@mines-nantes.fr   31
Upcoming SlideShare
Loading in …5
×

White-box texting of (ATL) model transformations

1,240 views

Published on

  • Be the first to comment

  • Be the first to like this

White-box texting of (ATL) model transformations

  1. 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. 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. 3. White-Box Testing Techniques Control Flow Graph / Data Flow Graph © AtlanMod - atlanmod-contact@mines-nantes.fr 3
  4. 4. White-Box Testing Techniques Control Flow Graph / Data Flow Graph White-Box Testing Criterion © AtlanMod - atlanmod-contact@mines-nantes.fr 4
  5. 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. 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. 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. 8. ATLTest: Overall Picture © AtlanMod - atlanmod-contact@mines-nantes.fr 8
  9. 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. 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. 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. 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. 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. 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. 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. 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. 17. ATLTest: Dependency Graph Generation © AtlanMod - atlanmod-contact@mines-nantes.fr 17
  18. 18. ATLTest: Dependency Graph Generation © AtlanMod - atlanmod-contact@mines-nantes.fr 18
  19. 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. 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. 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. 22. ATLTest: Graph Traversal (Condition Cov.) © AtlanMod - atlanmod-contact@mines-nantes.fr 22
  23. 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. 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. 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. 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. 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. 28. ATLTest: Generating Test Cases...the following test case is yielded PublicationSection3 ... PublicationSection25 © AtlanMod - atlanmod-contact@mines-nantes.fr 28
  29. 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. 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. 31. Thank you!Questions? © AtlanMod - atlanmod-contact@mines-nantes.fr 31

×