# Template-based model generation

## Abstract

Given their vital roles in model-based software engineering, the performance of model-related operations (MOs, such as model transformations) must be systematically tested. However, how to produce a set of large input models that conform to *structure-related constraints* presents a major challenge to such test. This paper proposes a template-based approach to efficient model generation. Firstly, a DSL is provided to describe templates that specify *how* to generate a valid model that conforms to structure-related constraints. Secondly, a *folding* semantic is defined to convert templates into a wrapper metamodel. Thirdly, a wrapper model is generated using the existing model generators (e.g., a random model generator) according to the wrapper metamodel. Fourthly, an *unfolding* semantics is specified to translate the wrapper model into the desired test input. This paper also presents five case studies to evaluate the proposed approach, and the results demonstrate that such approach can generate large models based on structure-related constraints and facilitate the performance testing of MOs.

### Keywords

Model generation Templates Performance testing Model-oriented operations Model-based engineering## Notes

### Acknowledgements

We would like to thank Dr. Zheng Cheng for his valuable discussion and comments on the paper. We also thank the anonymous reviewers for their review comments and revision suggestions.

### References

- 1.Ali, S., Iqbal, M.Z.Z., Arcuri, A., Briand, L.C.: Generating test data from OCL constraints with search techniques. IEEE Trans. Software Eng.
**39**(10), 1376–1402 (2013). https://doi.org/10.1109/TSE.2013.17 CrossRefGoogle Scholar - 2.Anastasakis, K., Bordbar, B., Georg, G., Ray, I.: On challenges of model transformation from UML to alloy. Softw. Syst. Model.
**9**(1), 69–86 (2010)CrossRefGoogle Scholar - 3.Arendt, T., Biermann, E., Jurack, S., Krause, C., Taentzer, G.: Henshin: advanced concepts and tools for in-place EMF model transformations. In: Petriu, D.C., Rouquette, N., Haugen, Ø. (eds.) Proceedings of the 13th International Conference on Model Driven Engineering Languages and Systems, MODELS’10, pp. 121–135. Springer, Berlin (2010)CrossRefGoogle Scholar
- 4.Arendt, T., Habel, A., Radke, H., Taentzer, G.: From core OCL invariants to nested graph constraints. In: Giese, H., önig, B.K. (eds.) Proceedings of the 7th International Conference on Graph Transformation, ICGT’14, pp. 97–112. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-09108-2_7 Google Scholar
- 5.Bailey, C., Montrieux, L., de Lemos, R., Yu, Y., Wermelinger, M.: Run-time generation, transformation, and verification of access control models for self-protection. In: Proceedings of the 9th International Symposium on Software Engineering for Adaptive and Self-Managing Systems, SEAMS 2014, pp. 135–144. ACM, New York, NY, USA (2014). https://doi.org/10.1145/2593929.2593945
- 6.Brottier, E., Fleurey, F., Steel, J., Baudry, B., Le Traon, Y.: Metamodel-based test generation for model transformations: an algorithm and a tool. In: Proceedings of the 7th International Symposium on Software Reliability Engineering, ISSRE’06, pp. 85–94. IEEE (2006)Google Scholar
- 7.Cabot, J., Clarisó, R., Guerra, E., de Lara, J.: Verification and validation of declarative model-to-model transformations through invariants. J. Syst. Softw.
**83**(2), 283–302 (2010)CrossRefGoogle Scholar - 8.Chen, X., Li, A., Zeng, X., Guo, W., Huang, G.: Runtime model based approach to iot application development. Front. Comput. Sci. China
**9**(4), 540–553 (2015)CrossRefGoogle Scholar - 9.Czarnecki, K., Helsen, S.: Feature-based survey of model transformation approaches. IBM Syst. J.
**45**(3), 621–645 (2006). https://doi.org/10.1147/sj.453.0621 CrossRefGoogle Scholar - 10.Ehrig, K., Küster, J.M., Taentzer, G.: Generating instance models from meta models. Softw. Syst. Model.
**8**(4), 479–500 (2009)CrossRefGoogle Scholar - 11.Finot, O., Mottu, J.M., Sunye, G., Attiogbe, C.: Partial test oracle in model transformation testing. In: Duddy, K., Kappel, G. (eds.) Proceedings of the 6th International Conference on Theory and Practice of Model Transformations, Lecture Notes in Computer Science, vol. 7909, pp. 189–204. Springer, Berlin (2013)Google Scholar
- 12.Fleurey, F., Baudry, B., Muller, P., Traon, Y.L.: Qualifying input test data for model transformations. Softw. Syst. Model.
**8**(2), 185–203 (2009)CrossRefGoogle Scholar - 13.Fürst, L., Mernik, M., Mahnič, V.: Converting metamodels to graph grammars: doing without advanced graph grammar features. Softw. Syst. Model.
**14**(3), 1297–1317 (2015)CrossRefGoogle Scholar - 14.Giese, H., Wagner, R.: From model transformation to incremental bidirectional model synchronization. Softw. Syst. Model.
**8**(1), 21–43 (2009)CrossRefGoogle Scholar - 15.Giner, P., Pelechano, V.: Test-driven development of model transformations. In: Schürr, A., Selic, B. (eds.) Proceedings of the 12th International Conference on Model Driven Engineering Languages and Systems, Lecture Notes in Computer Science, vol. 5795, pp. 748–752. Springer, Berlin (2009)Google Scholar
- 16.González, C.A., Cabot, J.: Atltest: a white-box test generation approach for ATL transformations. In: Proceedings of the 15th International Conference on Model Driven Engineering Languages and Systems, pp. 449–464. Springer (2012)Google Scholar
- 17.Guerra, E., Soeken, M.: Specification-driven model transformation testing. Softw. Syst. Model.
**14**(2), 623–644 (2015)CrossRefGoogle Scholar - 18.He, X., Fu, Y., Sun, C.A., Ma, Z., Shao, W.: Towards model-driven variability-based flexible service compositions. In: Proceedings of the 39th Annual Conference on Computer Software and Applications Conference, COMPSAC’15, vol. 2, pp. 298–303 (2015). https://doi.org/10.1109/COMPSAC.2015.64
- 19.He, X., Li, W., Zhang, T., Liu, Y.: Towards parallel model generation for random performance testing of model-oriented operations. In: Proceedings of the 10th International Symposium on Theoretical Aspects of Software Engineering, TASE’16, pp. 57–64 (2016)Google Scholar
- 20.He, X., Zhang, T., Hu, C.J., Ma, Z., Shao, W.: An MDE performance testing framework based on random model generation. J. Syst. Softw.
**121**, 247–264 (2016). https://doi.org/10.1016/j.jss.2016.04.044 CrossRefGoogle Scholar - 21.He, X., Zhang, T., Ma, Z., Shao, W.: Randomized model generation for performance testing of model transformations. In: Proceedings of the 38th Annual International Computer Software and Applications Conference, COMPSAC’14. IEEE (2014)Google Scholar
- 22.Izsó, B., Szárnyas, G., Ráth, I.: Train benchmark. Budapest University of Technology and Economics, Technical report (2014)Google Scholar
- 23.Jackson, D., Schechter, I., Shlyakhter, I.: Alcoa: The alloy constraint analyzer. In: Proceedings of the International Conference on Software Engineering, ICSE’00, pp. 730–733. IEEE (2000)Google Scholar
- 24.Kolovos, D.S., Paige, R.F., Polack, F.A.C.: The epsilon object language (EOL). In: Rensink, A., Warmer, J. (eds.) Proceedings of the 2nd European Conference on Model Driven Architecture—Foundations and Applications, ECMDA-FA 2006, pp. 128–142. Springer, Berlin (2006). https://doi.org/10.1007/11787044_11 Google Scholar
- 25.Koning, M., ai Sun, C., Sinnema, M., Avgeriou, P.: VxBPEL: supporting variability for web services in BPEL. Inf. Softw. Technol.
**51**(2), 258–269 (2009). https://doi.org/10.1016/j.infsof.2007.12.002 CrossRefGoogle Scholar - 26.Kuhlmann, M., Hamann, L., Gogolla, M., Büttner, F.: A benchmark for OCL engine accuracy, determinateness, and efficiency. Softw. Syst. Model.
**11**(2), 165–182 (2012)CrossRefGoogle Scholar - 27.McQuillan, J.A., Power, J.F.: A metamodel for the measurement of object-oriented systems: An analysis using alloy. In: Proceedings of the 1st International Conference on Software Testing, Verification, and Validation, pp. 288–297. IEEE (2008)Google Scholar
- 28.Mougenot, A., Darrasse, A., Blanc, X., Soria, M.: Uniform random generation of huge metamodel instances. In: Proceedings of the 5th European Conference on Model Driven Architecture-Foundations and Applications, pp. 130–145. Springer (2009)Google Scholar
- 29.OASIS: Web services business process execution language version 2.0. Technical report, OASIS (2007)Google Scholar
- 30.Object Management Group: OMG Object Constraint Language (OCL) Specification Version 2.3.1 (2012). http://www.omg.org/spec/OCL/2.3.1
- 31.Pérez, C.A.G., Buettner, F., Clarisó, R., Cabot, J., et al.: Emftocsp: a tool for the lightweight verification of emf models. In: Proceedings of Formal Methods in Software Engineering: Rigorous and Agile Approaches (FormSERA) (2012)Google Scholar
- 32.Pietsch, P., Yazdi, H.S., Kelter, U.: Controlled generation of models with defined properties. In: Jähnichen, S., Küpper, A., Albayrak, S. (eds.) Software Engineering. Lecture Notes in Informatics, vol. 198, pp. 95–106 (2012)Google Scholar
- 33.Popoola, S., Kolovos, D.S., Rodriguez, H.H.: EMG: a domain-specific transformation language for synthetic model generation. In: Van Gorp, P., Engels, G. (eds.) Proceedings of the 9th International Conference on Theory and Practice of Model Transformations, ICMT 2016, pp. 36–51. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-42064-6_3 Google Scholar
- 34.Radke, H.: A Theory of HR* Graph Conditions and their Application to Meta-Modeling. Phd. thesis, Carl von Ossietzky Universität Oldenburg (2016)Google Scholar
- 35.Radke, H., Arendt, T., Becker, J.S., Habel, A., Taentzer, G.: Translating essential OCL invariants to nested graph constraints focusing on set operations. In: Parisi-Presicce, F., Westfechtel, B. (eds.) Proceedings of the 8th International Conference on Graph Transformation, ICGT’15, pp. 155–170. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21145-9_10 Google Scholar
- 36.Scheidgen, M.: Generation of large random models for benchmarking. In: Proceedings of the 3rd Workshop on Scalable Model Driven Engineering, pp. 1–10. L’Aquila, Italy (2015)Google Scholar
- 37.Sen, S., Baudry, B., Mottu, J.M.: On combining multi-formalism knowledge to select models for model transformation testing. Proceedings of the 2008 International Conference on Software Testing, Verification, and Validation, ICST ’08, pp. 328–337. IEEE Computer Society, Washington (2008). https://doi.org/10.1109/ICST.2008.62 CrossRefGoogle Scholar
- 38.Sen, S., Baudry, B., Mottu, J.M.: Automatic model generation strategies for model transformation testing. In: Paige, R.F. (ed.) Proceedings of the 2nd International Conference on Theory and Practice of Model Transformations, ICMT 2009, pp. 148–164. Springer, Berlin (2009). https://doi.org/10.1007/978-3-642-02408-5_11 Google Scholar
- 39.Soeken, M., Wille, R., Drechsler, R.: Encoding OCL data types for sat-based verification of UML/OCL models. In: Tests and Proofs, pp. 152–170. Springer (2011)Google Scholar
- 40.Song, H., Huang, G., Chauvel, F., Xiong, Y., Hu, Z., Sun, Y., Mei, H.: Supporting runtime software architecture: a bidirectional-transformation-based approach. J. Syst. Softw.
**84**(5), 711–723 (2011)CrossRefGoogle Scholar - 41.Sun, C.A., Rossing, R., Sinnema, M., Bulanov, P., Aiello, M.: Modeling and managing the variability of web service-based systems. J. Syst. Softw.
**83**(3), 502–516 (2010). https://doi.org/10.1016/j.jss.2009.10.011 CrossRefGoogle Scholar - 42.Szárnyas, G., Izsó, B., Ráth, I., Varró, D.: The Train Benchmark: Cross-technology performance evaluation of continuous model validation. Softw. Syst. Model. (2017). https://doi.org/10.1007/s10270-016-0571-8
- 43.Taentzer, G.: Instance generation from type graphs with arbitrary multiplicities. ECEASST
**47**, 1–15 (2012). https://doi.org/10.14279/tuj.eceasst.47.727 - 44.Ujhelyi, Z., Bergmann, G., Hegedüs, Á., Horváth, Á., Izsó, B., Ráth, I., Szatmári, Z., Varró, D.: EMF-incquery: an integrated development environment for live model queries. Sci. Comput. Program.
**98**, 80–99 (2015)CrossRefGoogle Scholar - 45.Van Amstel, M., Bosems, S., Kurtev, I., Pires, L.F.: Performance in model transformations: experiments with ATL and QVT. In: Proceedings of the 4th International Conference on Theory and Practice of Model Transformations, pp. 198–212. Springer (2011)Google Scholar