Agile Test-Based Modeling

Agile Test-Based Modeling

Agile Test-based Modeling Bernhard Rumpe Software Systems Engineering TU Braunschweig, Germany www.sse.cs.tu-bs.de continuous improvement of these features. It is Model driven architecture (MDA) concentrates on foreseeable that together with the effort of defining the use of models during software development. An virtual machines respectively executable UML, a large approach using models as the central development sublanguage of the UML will become a high-level artifact is more abstract, more compact and thus programming language and modeling at this level more effective and probably also less error prone. becomes identical to programming. This raises a Although the ideas of MDA exist already for years, number of interesting questions: there is still much to improve in the development • Is it critical for a modeling language to be also process as well as the underlying techniques and used as programming language? For example tools. Therefore, this paper is a follow up on [13], analysis and design models may become reexamining und updating the statements made there. Here two major and strongly related overloaded with details that are not of interest yet, techniques are identified and discussed: Test case because modelers are addicted to executability. To modeling and an evolutionary approach to model our experience, high-level designs then become transformation. too detailed to be reused in different applications. As a consequence it would be necessary to Keywords: Model-based programming, Model-based integrate an executable sublanguage of the UML testing, Agile methods, Model evolution with a specification-oriented and not-executable language for reuse of requirement captures. • Is the UML expressive enough to describe 1 Introduction: Modeling meets systems completely or will it be accompanied by Programming conventional languages? How well are these integrated? We believe that there will be The UML [1] has become the most popular modeling techniques to thoroughly integrate several language for software intensive systems. UML as well languages. Today, executable pieces of code as other models (Matlab or domain specific ones) can written e.g. in Java are still treated like strings be used for quite a variety of purposes. Among them within UML models. In the future, there will be diagrams are still mainly used for documentation of better integration and specifically, there will be requirements and design. Requirements are usually techniques for composition of such language captured in natural language and a few informal and parts. top-level drawings that denote an abstract architecture, • How will the toolset of the future look like and use cases or activity diagrams. Architecture and how will it overcome round trip engineering (i.e. designs are then captured and documented with mapping code and diagrams in both directions)? models. In practice, these models are increasingly We believe that round-trip engineering is not a often used for generation of code respectively code technique that will last for ever. Round-trip had frames that are filled in manually. been used in a similar way, when people didn’t More sophisticated and therefore less widespread uses trust compilers and wanted to check and change of models are analysis of certain features (such as compiled code manually. But today, it’s quite throughput, robustness, failure likelihood), generation unclear to understand how to overcome this kind of tests from models and a transformation based of jojo-engineering. evolutionary approach from high-level models to • What are the implications of an executable UML running code. Quite a few UML-based tools offer on the development process? Only few people believe in the UML as a full programming language. Indeed, the UML (including its action functionality to emulate models or generate code or at language, OCL and behavioral diagrams) is in its least code frames. Tool vendors still work hard on current form not very convenient for [Rum06] B. Rumpe. Agile Test-based Modeling. In: Proceedings of the 2006 International Conference on Software Engineering Research & Practice. SERP‘2006. CSREA Press, USA, June 2006. www.se-rwth.de/publications programming. However, if tooling becomes more production and test code. The notations on the left efficient and the UML is enriched with side are usually considered “complete” and are appropriate programming concepts, this might therefore useful for generating production code, change. But will it lead to better code or just more whereas the notations on the right are “exemplaric” quickly to bad implementations? and thus useful for modeling individual tests. In [4,5] we have discussed these issues and have However, both sides are not disjoint, because it’s demonstrated, how the UML in combination with Java possible to generate e.g. initialization code from an may be used as a high-level programming language. object diagram as well as test drivers from a But, to ensure quality of the result the UML cannot statechart. only be used for modeling the application, but more importantly for modeling tests on various levels The following section 2 discusses the combination of (class, integration, and system tests) as well. agile methods and model-based software development One advantage of using models for test case from a methodical point of view. It is argued that the description is that application specific parts are use of models increases efficiency, quality and other modeled with UML-diagrams and technical issues, project elements such that the project can be such as connection to frameworks, error handling, downsized and run in an agile way. As primary persistence, or communication can be handled by the technical elements of model-based development, the parameterized code generator. This basically allows us definition of model-based tests is discussed in section to develop models independent of any technology or 3 and the evolution (refactoring) of models is platform, as for example proposed in [6]. Only in the discussed in section 4. Section 5 gives a final generation process platform dependent elements are conclusion and summary. added. When the technology changes, we only need to update the generator, but the application defining models can be reused without much change. This 2 Agile Modeling: Using Models in concept also supports the above mentioned MDA- Approach [2] of the OMG. Another important Agile Projects advantage is that both, the production code and automatically executable tests at any level, are In the last years a number of Agile Methods [9] have modeled by the same kind of UML diagrams. been brought to practice that share a some special Therefore developers use a single homogeneous characteristics subsumed under “agile” resp. “light- language to describe implementation and tests. This weight”. Among these Extreme Programming (XP) will enhance the availability of tests already at the [3] is currently the most widely used and discussed beginning of the coding activities. Similar to the “test method [17]. Some of the XP characteristics are: first approach” [7,8], sequence diagrams are used to • XP early focuses on the primary goal, the running model drives of test cases. They can be taken from production code. Other artifacts, like requirements that have also been modeled using documentation are produced and used only in a sequence diagrams. very limited way, but coding standards are enforced to document the code. • At any stage of development, automated tests are statecharts object diagrams used to ensure quality of the result. Our practical __: __: class diagrams sequence diagrams experience shows, that when this is properly done, Java OCL __: the defect rate is in fact considerably low. Furthermore, the automation allows us as well as code and thickness of arrow new developers and the paying customer to repeat test case indicates importance generation of generation tests continuously, even if the customer doesn’t production test code code understand the content of the test. Fig. 1. Mapping of UML-models to code and test code • Very small iterations with continuous integration Some of the UML-models (mainly deployment and are enforced and the system is kept as simple as class diagrams as well as statecharts) are used possible. constructively, while others are used for test case • Refactoring of code is used to improve the code definition (mainly OCL, sequence and enhanced structure and tests ensure the defect rate object diagrams). The following Fig. 1 illustrates the introduced through refactoring is rather small if key mappings from various diagrams to the existent at all. The lack of documentation is motivated by the • The modeling technique itself can be used to reduction of workload gained and the observation, that describe a test case or at least a part thereof. developers don’t trust documents anyway, because The first two forms have already been discussed e.g. these are out of date too often. So, XP focuses on in [15]. Therefore, in this section we concentrate on code. All design activities manifest in the code the development of models that describe tests. A directly. Quality is ensured through strong emphasis typical test, as shown in Fig. 2 consists of a on testing activities, ideally on development of the description of the test data, the test driver and an tests before the production code oracle characterizing the desired test result. In object- (“test first approach” [7]). An explicit architectural oriented environments, the test data can usually be design phase is abandoned and the architecture described by an object diagram (OD). It shows the emerges during coding. Architectural shortcomings objects necessary to run the test as well as concrete are resolved through the application of refactoring values for their attributes and the linking structure. techniques [10,11]. These are transformational The test driver can be modeled using a simple method techniques to refactor a system in small steps to call or, if more complex, a sequence diagram (SD).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us