high tech

What is the difference between Model Based Testing and Model Driven Engineering?

  • 29 November 2021
  • 3 minutes

The complexity of software intensive systems is ever increasing. Model Driven Design technologies and code generation have the potential to manage complexity and increase software development efficiency. Model Driven Engineering (MDE) and Model Based Testing (MBT) are methods to design software faster, cheaper and more efficiently. 

Based on the system requirements, you make an abstract model. This model serves as a common language for all stakeholders to improve comprehensibility and reduce system complexity. Tools then automatically generate the code for the system (MDE) or for the test (MBT). The result: more innovative products that you can bring to market faster. As one of the first software companies to specialize in these relatively new approaches to software design, ICT Group looks forward to assisting you by sharing our knowhow, expertise and experience. 

Because of people’s interest Julien Schmaltz (Principal Consultant), was asked what the difference is between Model Based Testing and Model Driven Engineering. He will explain this by using the V-Model.


An explanation based on the V-Model

Model Based Testing automates the generation and the execution of test cases from a model. On the V-model this automates work from left to right. Model driven engineering is about automating the generation of code from a model. On the V-model, this automates work going from top to bottom. This is the very short answer ! Let’s continue a little more.

A model for test generation is a precise representation of what a system is supposed to do. The model based testing tools then automatically generate and execute tests that will pass if and only if the system under test is conforming to the model. Such models can be created at different levels of abstraction. One can make a model of a requirement and automate acceptance testing. At the code level, one can make a model of a method and automate unit testing. Any level in between is also possible. A nice feature of Model Based Testing is the possibility to model only parts of a systems – say, a small set of requirements – and already obtain the benefits of automated testing. Model based testing consists in creating a precise representation of what is expected. The actual checking whether a system under test actually fulfils the expectations is automated.

A model for code generation is a precise representation of how a system is implemented. From such a model, actual code – in any language you like, typically Java or C++ – is generated. A fundamental difference between models for test generation and models for code generation is the required level of details and completeness. It is enough to know that a connection request can succeed or fail to start testing a server application. This is not enough to generate the actual server application. We need details about how this server works. For code generation, models need to contain enough information so that code can be generated. Many trends and initiatives are working hard in raising the level of abstraction at which code generation is possible. The design level is often the highest level of abstraction at which automated code generation is used.

Both approaches are complementary and can be combined. You can for instance use Model Based Testing for acceptance test of an application generated using low-code platforms. The only restriction is that you cannot use the same model to generate code and to generate test for that code. In general, one should test code generators and not generated code. The main objective is to consider generated code correct by construction.