Design and validation of a C plus plus code generator from Abstract State Machines specifications

被引:22
作者
Bonfanti, Silvia [1 ]
Gargantini, Angelo [1 ]
Mashkoor, Atif [2 ,3 ]
机构
[1] Univ Bergamo, Dept Management Informat & Prod Engn, Bergamo, Italy
[2] Software Competence Ctr Hagenberg, Hagenberg, Austria
[3] Johannes Kepler Univ Linz, Inst Software Syst Engn, Linz, Austria
关键词
abstract state machine; automatic code generation; C plus plus; model-driven engineering; transformation validation; unit tests generation; MODEL TRANSFORMATIONS;
D O I
10.1002/smr.2205
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
According to best practices of model-driven engineering, the implementation of a system should be obtained from its model through a systematic model-to-code transformation. We present in this paper a methodology supported by the Asm2C++ tool, which allows the users to generate C++ code from abstract state machine models. Thanks to Asm2C++, the implementation is generated in a seamless manner with an assurance of potential bug freeness of the generated code. Following the same approach, model-based testing suggests deriving also (unit) tests from abstract models. We extend the Asm2C++ tool such that it can automatically produce unit tests for the generated code. test sequences, either generated randomly or through model checking, are translated to concrete C++ unit tests using the Boost library. In a similar manner, also, scenarios are generated in a behavior-driven development (BDD) approach. To guarantee the correctness of the transformation process, we define a mechanism to test the correctness of the model-to-code transformation with respect to two main criteria: syntactical correctness and semantic correctness, which is based on the definition of conformance between the specification and the code. Using this approach, we have devised a process able to test the generated code by reusing unit tests. The process has been used to validate our model-to-code transformations.
引用
收藏
页数:25
相关论文
共 39 条
[1]   A survey of approaches for verifying model transformations [J].
Ab Rahim, Lukman ;
Whittle, Jon .
SOFTWARE AND SYSTEMS MODELING, 2015, 14 (02) :1003-1028
[2]  
Ambert F, 2002, FORMAL APPROACHES TE, P105
[3]  
[Anonymous], 2004, The Unified Modeling Language Reference Manual
[4]  
[Anonymous], 2014, 2014 51 ACM EDAC IEE, P1
[5]  
[Anonymous], 2005, B BOOK ASSIGNING PRO
[6]  
Arcaini P, 2017, IEEE T SOFTWARE ENG, VPP
[7]   A model-driven process for engineering a toolset for a formal method [J].
Arcaini, Paolo ;
Gargantini, Angelo ;
Riccobene, Elvinia ;
Scandurra, Patrizia .
SOFTWARE-PRACTICE & EXPERIENCE, 2011, 41 (02) :155-166
[8]   Barriers to Systematic Model Transformation Testing [J].
Baudry, Benoit ;
Ghosh, Sudipto ;
Fleurey, Franck ;
France, Robert ;
Le Traon, Yves ;
Mottu, Jean-Marie .
COMMUNICATIONS OF THE ACM, 2010, 53 (06) :139-143
[9]  
Beckert B, 2007, VERIFICATION OJECT O
[10]  
Bonfanti S, 2018, ICTSS 2018 TESTING S, P17