Abstract
Visual contracts model the operation of components or services by pre- and post-conditions formalised as graph transformation rules. They provide a precise intuitive notation to support testing, understanding and analysis of software. Their detailed specification of internal data states and transformations, referred to as deep behavioural modelling, is an error-prone activity. In this paper we propose a dynamic approach to reverse engineering visual contracts from Java based on tracing the execution of Java operations. The resulting contracts give an accurate description of the observed object transformations, their effects and preconditions in terms of object structures, parameter and attribute values, and their generalised specification by universally quantified (multi) objects, patterns, and invariants. While this paper focusses on the fundamental technique rather than a particular application, we explore potential uses in our evaluation, including in program understanding, review of test reports and debugging.
Similar content being viewed by others
Notes
We have used Cobertura, a code coverage utility for Java, to calculate the percentage of the covered code by our tests. It is available at http://cobertura.github.io/cobertura/.
Social Science Statistics, P Value from T Score Calculator, http://www.socscistatistics.com/pvalues/tdistribution.aspx.
A JUnit test case generator https://developers.google.com/java-dev-tools/codepro/doc/features/junit/test_case_generation.
A tool to record GUI tests for Swing applications, https://developers.google.com/java-dev-tools/wintester/html/gettingstarted/swing_sampletest.
References
Alshanqiti, A.M., Heckel, R.: Towards dynamic reverse engineering visual contracts from java. In: Electronic Communications of the EASST, vol. 67 (2014). http://journal.ub.tu-berlin.de/eceasst/article/view/940
Alshanqiti, A., Heckel, R.: Extracting visual contracts from java programs. In: International Conference on Automated Software Engineering, pp. 104–114. ACM (2015)
Alshanqiti, A.M., Heckel, R., Khan, T.: Learning minimal and maximal rules from observations of graph transformations. Electronic Communications of the EASST, vol. 58 (2013)
Alshanqiti, A.M., Heckel, R., Kehrer, T.: Visual contract extractor: a tool for reverse engineering visual contracts using dynamic analysis. In: Lo, D., Apel, S., Khurshid, S. (eds.) Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, ASE 2016, Singapore, September 3–7, 2016, pp. 816–821. ACM, London (2016). https://doi.org/10.1145/2970276.2970287
Arendt, T., Taentzer, G.: A tool environment for quality assurance based on the eclipse modeling framework. Autom. Softw. Eng. 20(2), 141–184 (2013)
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.) Model Driven Engineering Languages and Systems—13th International Conference, MODELS 2010, Oslo, Norway, October 3–8, 2010, Proceedings, Part I, Lecture Notes in Computer Science, vol. 6394, pp. 121–135. Springer, Berlin (2010). https://doi.org/10.1007/978-3-642-16145-2_9
Artzi, S., Ernst, M.D., Kieżun, A., Pacheco, C., Perkins, J.H.: Finding the needles in the haystack: generating legal test inputs for object-oriented programs. In: Proceedings of 1st Workshop on Model-Based Testing and Object-Oriented Systems (2006)
Balogh, Z., Varr, D.: Model transformation by example using inductive logic programming. Int. J. Softw. Syst. Model. 8(3), 347–364 (2009)
Barr, E.T., Harman, M., McMinn, P., Shahbaz, M., Yoo, S.: The oracle problem in software testing: a survey. IEEE Trans. Softw. Eng. 41(5), 507–525 (2015). https://doi.org/10.1109/TSE.2014.2372785
Bisztray, D., Heckel, R., Ehrig, H.: Verification of architectural refactorings: rule extraction and tool support. In: ECEASST, vol. 16 (2009)
Brito, H., Marques-Neto, H., Terra, R., Rocha, H., Valente, M.: On-the-fly extraction of hierarchical object graphs. J. Braz. Comput. Soc. 19(1), 15–27 (2012)
Bruggink, H.: Towards process mining with graph transformation systems. In: Giese, H., Knig, B. (eds.) Graph Transformation, Lecture Notes in Computer Science, vol. 8571, pp. 253–268. Springer, Berlin (2014). https://doi.org/10.1007/978-3-319-09108-2_17
Bürdek, J., Kehrer, T., Lochau, M., Reuling, D., Kelter, U., Schürr, A.: Reasoning about product-line evolution using complex feature model differences. Autom. Softw. Eng. 23(4), 687–733 (2015)
Dolques, X., Dogui, A., Falleri, J.R., Huchard, M., Nebut, C., Pfister, F.: Easing model transformation learning with automatically aligned examples. In: Proceedings of the 7th European Conference on Modelling Foundations and Applications, ECMFA’11, pp. 189–204. Springer, Berlin (2011)
Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph Transformation. Springer, Berlin (2006)
Engels, G., Lohmann, M., Sauer, S., Heckel, R.: Model-driven monitoring: an application of graph transformation for design by contract. In: Corradini, A., Ehrig, H., Montanari, U., Ribeiro, L., Rozenberg, G. (eds.) Graph Transformations, Third International Conference, ICGT 2006, Natal, Rio Grande do Norte, Brazil, September 17–23, 2006, Proceedings, Lecture Notes in Computer Science, vol. 4178, pp. 336–350. Springer, Berlin (2006). https://doi.org/10.1007/11841883_24
Ernst, M.D., Perkins, J.H., Guo, P.J., McCamant, S., Pacheco, C., Tschantz, M.S., Xiao, C.: The Daikon system for dynamic detection of likely invariants. Sci. Comput. Program. 69(1–3), 35–45 (2007). https://doi.org/10.1016/j.scico.2007.01.015. http://www.sciencedirect.com/science/article/pii/S016764230700161X. Special issue on Experimental Software and Toolkits
Faunes, M., Sahraoui, H., Boukadoum, M.: Generating model transformation rules from examples using an evolutionary algorithm. In: Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering, pp. 250–253. ACM, London (2012)
Geiger, L., Zündorf, A.: eDOBS-graphical debugging for eclipse. In: Electronic Communications of the EASST, vol. 1 (2007)
Hamann, L., Hofrichter, O., Gogolla, M.: OCL-based runtime monitoring of applications with protocol state machines. In: Proceedings of 8th European Conference on Modelling Foundations and Applications, pp. 384–399 (2012). https://doi.org/10.1007/978-3-642-31491-9_29
Hausmann, J.H., Heckel, R., Lohmann, M.: Model-based development of web services descriptions enabling a precise matching concept. Int. J. Web Serv. Res. 2(2), 67–84 (2005). https://doi.org/10.4018/jwsr.2005040104
Heckel, R., Lohmann, M.: Towards contract-based testing of web services. Electron. Notes Theor. Comput. Sci. 116, 145–156 (2005). https://doi.org/10.1016/j.entcs.2004.02.073. http://www.sciencedirect.com/science/article/pii/S1571066104052831
Kappel, G., Langer, P., Retschitzegger, W., Schwinger, W., Wimmer, M.: Model transformation by-example: a survey of the first wave. In: Düsterhöft, A., Klettke, M., Schewe, K.D. (eds.) Conceptual Modelling and Its Theoretical Foundations, pp. 197–215. Springer, Berlin (2012a)
Kehrer, T., Kelter, U., Taentzer, G.: A rule-based approach to the semantic lifting of model differences in the context of model versioning. In: 26th International Conference on Automated Software Engineering, pp. 163–172 (2011)
Kehrer, T., Rindt, M., Pietsch, P., Kelter, U.: Generating edit operations for profiled UML models. In: Proceedings of International Workshop on Models and Evolution, CEUR Workshop Proceedings, vol. 1090, pp. 30–39 (2013)
Kehrer, T., Taentzer, G., Rindt, M., Kelter, U.: Automatically deriving the specification of model editing operations from meta-models. In: Proceedings of 9th International Conference on Model Transformations, pp. 173–188. Springer, Berlin (2016)
Kehrer, T., Alshanqiti, A.M., Heckel, R.: Automatic inference of rule-based specifications of complex in-place model transformations. In: Theory and Practice of Model Transformation—10th International Conference, ICMT 2017, Held as Part of STAF 2017, Marburg, Germany, July 17–18, 2017, Proceedings, pp. 92–107 (2017). https://doi.org/10.1007/978-3-319-61473-1_7
Khan, T.A., Runge, O., Heckel, R.: Testing against visual contracts: model-based coverage. In: Proceedings of International Conference on Graph Transformation, pp. 279–293 (2012)
Langer, P., Wimmer, M., Kappel, G.: Model-to-model transformations by demonstration. In: Tratt, L., Gogolla, M. (eds.) Proceedings of the Third International Conference on Theory and Practice of Model Transformations, Lecture Notes in Computer Science, vol. 6142, pp. 153–167. Springer, Berlin (2010)
Malpani, A., Bernstein, P., Melnik, S., Terwilliger, J.: Reverse engineering models from databases to bootstrap application development. In: Proceedings of 26th International Conference on Data Engineering, pp. 1177–1180 (2010). https://doi.org/10.1109/ICDE.2010.5447776
Mariani, L., Pezzè, M.: A technique for verifying component-based software. Electron. Notes Theor. Comput. Sci. 116, 17–30 (2005). https://doi.org/10.1016/j.entcs.2004.02.089
Martinez, L., Pereira, C., Favre, L.: Recovering activity diagrams from object oriented code: an MDA-based approach. In: Proceedings of International Conference on Software Engineering Research and Practice, vol. 1, pp. 58–64 (2011)
Mens, T., Van Gorp, P.: A taxonomy of model transformation. Electron. Notes Theor. Comput. Sci. 152, 125–142 (2006)
Pavletic, D., Voelter, M., Raza, S.A., Kolb, B., Kehrer, T.: Extensible debugger framework for extensible languages. In: Reliable Software Technologies—Ada-Europe 2015, pp. 33–49. Springer, Berlin (2015)
Rountev, A., Volgin, O., Reddoch, M.: Static control-flow analysis for reverse engineering of uml sequence diagrams. SIGSOFT Softw. Eng. Notes 31(1), 96–102 (2005)
Runge, O., Khan, T.A., Heckel, R.: Test case generation using visual contracts. In: ECEASST, vol. 58 (2013)
Sarkar, M.K., Chatterjee, T., Mukherjee, D.: Reverse engineering: an analysis of static behaviors of object oriented programs by extracting UML class diagram. Int. J. Adv. Comput. Res. 3(3), 135 (2013)
Shamshiri, S., Just, R., Rojas, J.M., Fraser, G., McMinn, P., Arcuri, A.: Do automatically generated unit tests find real faults? An empirical study of effectiveness and challenges. In: Cohen, M.B., Grunske, L., Whalen, M. (eds.) 30th IEEE/ACM International Conference on Automated Software Engineering, ASE 2015, Lincoln, NE, USA, November 9–13, 2015, pp. 201–211. IEEE Computer Society, Washington (2015). https://doi.org/10.1109/ASE.2015.86
Strüber, D., Born, K., Gill, K.D., Groner, R., Kehrer, T., Ohrndorf, M., Tichy, M.: Henshin: A usability-focused framework for EMF model transformation development. In: ICGT (2017)
Tonella, P., Potrich, A.: Reverse engineering of the interaction diagrams from C++ code. In: Software Maintenance, 2003. International Conference on ICSM 2003. Proceedings, pp. 159–168 (2003)
Varró, D.: Model transformation by example. In: International Conference on Model Driven Engineering Languages and Systems, pp. 410–424. Springer, Berlin (2006)
You, C., Holder, L.B., Cook, D.J.: Learning patterns in the dynamics of biological networks. In: International Conference on Knowledge Discovery and Data Mining, pp. 977–986. ACM, London (2009)
Zhao, C., Kong, J., Zhang, K.: Program behavior discovery and verification: a graph grammar approach. IEEE Trans. Softw. Eng. 36(3), 431–448 (2010)
Ziadi, T., Da Silva, M.A.A., Hillah, L.M., Ziane, M.: A fully dynamic approach to the reverse engineering of UML sequence diagrams. In: 16th IEEE International Conference on Engineering of Complex Computer Systems (ICECCS), pp. 107–116. IEEE, Washington (2011)
Acknowledgements
We would like to thank Michel Chaudron and Neil Walkinshaw for the valuable advice and feedback on conducting user experiments.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Alshanqiti, A., Heckel, R. & Kehrer, T. Inferring visual contracts from Java programs. Autom Softw Eng 25, 745–784 (2018). https://doi.org/10.1007/s10515-018-0242-9
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10515-018-0242-9