Model-Driven Testing in Umple

Total Page:16

File Type:pdf, Size:1020Kb

Model-Driven Testing in Umple Model-Driven Testing in Umple Sultan Eid A. Almaghthawi A thesis submitted in partial fulfillment of the requirements for the degree Ph.D in Computer Science Ottawa-Carleton Institute for Computer Science School of Electrical Engineering and Computer Science University of Ottawa Ottawa, Ontario, Canada April 2020 © Sultan Eid A. Almaghthawi, Ottawa, Canada, 2020 Acknowledgement Firstly, I would like to express my sincere gratitude to my supervisor Prof. Timothy Lethbridge for the continuous support of my Ph.D study and related research, for his patience, motivation, and immense knowledge. His guidance helped me in all the time of research and writing of this thesis. I could not have imagined having a better advisor and mentor for my Ph.D study. Besides my advisor, I would like to thank the rest of my thesis committee: Prof. Thomas R. Dean, Prof. Daniel Amyot, Prof. jean-Pierre Corriveau, and Prof. Stéphane Somé, for their insightful comments and encouragement, but also for the hard question which incented me to widen my research from various perspectives. Thanks to my country who had provided all the support needed and has always looked after its students. Also, thank you Taibah University for giving me the opportunity to pursue my study and providing the support needed especially professor Mosaed Alsobhe for his great insight and support during my early years as an academic. I also would like to thank everyone in the The Complexity Reduction in Software Engineering (CRUISE). All the discussion, brainstorming and code sprints we had over the years made this work possible. Last but not least, I would like to thank my family: Thank you and much love my wife Lamia; your endless support during the endeavor is forever appreciated. Thanks to my parents Fann and Eid for everything, may my father soul rest in peace, words cannot describe how gratefully I am for everything they have provided. Thanks to my brothers and sisters for supporting me spiritually throughout writing this thesis and my life in general. ii Abstract In this thesis we present a language and technique to facilitate model-based testing. The core of our approach is an xUnit-like language that allows tests to refer to model entities such as associations. This language can be used by developers to describe tests based on an existing UML model. The tests might even be written before creating a UML model, and be based on requirements. The testing language, including its parser and generators, is written entirely in Umple, an open-source textual modeling tool with semantics closely based on UML, and which generates Java, PHP and several other target languages. Tests in our language can be embedded in Umple or in standalone files. The test language compiler converts our abstract testing language into JUnit, PHPUnit and other domain-language testing environments. In addition to allowing developers to write tests manually, we have created generators that create abstract tests for any Umple model. These generators can be used to verify the Umple compiler and to give Umple users extra confidence in their models. User-defined tests can be standalone or embedded in methods; they can be generic, referring to metamodel elements. Tests can also be located in traits or mixsets to allow testing of separate concerns or product lines. To test our language and the tests written in it, we have created an extensive test suite. We have also implemented mutation testing, that enables varying of features of the models to ensure that runs of the pre-mutation tests then fail. iii Table of Contents Chapter 1 Introduction ........................................................................................................... 1 1.1 Thesis Topic and Contributions .................................................................................. 1 1.2 Problem Statement ...................................................................................................... 3 1.3 Motivation and Benefits .............................................................................................. 3 1.4 Methodology: Design Science .................................................................................... 5 1.5 Research Questions ..................................................................................................... 7 1.5.1 RQ1: What would be an effective syntax and semantics for an abstract model- level test language for testing UML class models? ................................................................. 7 1.5.2 RQ2: How can we evaluate the quality of the test specifications and the automatically generated tests? ................................................................................................. 8 1.6 Thesis Outline ............................................................................................................. 8 Chapter 2 Background............................................................................................................ 9 2.1 Software Testing ......................................................................................................... 9 2.2 Model-Based Testing ................................................................................................ 10 2.2.1 What is Model-Based Testing? ......................................................................... 10 2.2.2 Why Model-Based Testing? ............................................................................. 11 2.2.3 Where are the Weaknesses of Model-Based Testing? ...................................... 11 2.2.4 The Difference Between Model-Based and Model-Driven .............................. 13 2.2.5 Is Our Approach Offline-Testing or Online-Testing? ...................................... 14 2.3 Overview of Umple................................................................................................... 14 2.3.1 Umple Features Relevant to This Thesis: Mixins, Traits and Mixsets ............. 17 2.4 Model-Based Testing Tools and Technologies......................................................... 17 2.4.1 Conformiq Designer/Creator, Previously Known as Leirios ............................ 18 2.4.2 MBTestSuite ..................................................................................................... 18 2.4.3 MoMuT::UML .................................................................................................. 19 iv 2.4.4 RT-Tester and RTT-MBT ................................................................................. 20 2.4.5 TTCN-3 and UTP ............................................................................................. 20 2.4.6 ETSI Test Description Language ...................................................................... 22 2.4.7 Spec Explorer / PyModel .................................................................................. 22 2.4.8 ACL Contracts .................................................................................................. 22 2.4.9 MaTeLo............................................................................................................. 23 2.4.10 ModelJUnit / GraphWalker............................................................................... 23 2.5 Other Techniques That Are Related ......................................................................... 24 2.5.1 Aspect-Oriented Programming ......................................................................... 24 2.5.2 Generative Programming .................................................................................. 25 2.6 Summary ................................................................................................................... 25 Chapter 3 Basics of Model-Based Testing in Umple ........................................................... 27 3.1 Umple’s Model-Based Testing Architecture ............................................................ 29 3.2 Model Transformations in Our Approach................................................................. 30 3.3 The Umple Test Model Parser .................................................................................. 32 3.4 Testing of Attributes ................................................................................................. 37 3.4.1 Testing Lazy Attributes..................................................................................... 39 3.4.2 Testing Immutable Attributes ........................................................................... 40 3.5 Testing Associations ................................................................................................. 41 3.5.1 Optional-One to Many Associations ................................................................. 44 3.5.2 One to Many Associations ................................................................................ 46 3.5.3 N to Many Associations Where N Is a Fixed Number > 1 .............................. 48 3.5.4 Directional Associations ................................................................................... 50 3.5.5 Lower-Bounded and Upper-Bounded Associations: N..N -- * ......................... 52 3.5.6 Immutable Unidirectional Associations ............................................................ 54 v 3.5.7 Sorted Association in Umple ............................................................................ 56 3.5.8 Chained Associations ........................................................................................ 57 3.5.9 Reflexive Associations.....................................................................................
Recommended publications
  • Unifying Modeling and Programming with ALF
    SOFTENG 2016 : The Second International Conference on Advances and Trends in Software Engineering Unifying Modeling and Programming with ALF Thomas Buchmann and Alexander Rimer University of Bayreuth Chair of Applied Computer Science I Bayreuth, Germany email: fthomas.buchmann, [email protected] Abstract—Model-driven software engineering has become more The Eclipse Modeling Framework (EMF) [5] has been and more popular during the last decade. While modeling the established as an extensible platform for the development of static structure of a software system is almost state-of-the art MDSE applications. It is based on the Ecore meta-model, nowadays, programming is still required to supply behavior, i.e., which is compatible with the Object Management Group method bodies. Unified Modeling Language (UML) class dia- (OMG) Meta Object Facility (MOF) specification [6]. Ideally, grams constitute the standard in structural modeling. Behavioral software engineers operate only on the level of models such modeling, on the other hand, may be achieved graphically with a set of UML diagrams or with textual languages. Unfortunately, that there is no need to inspect or edit the actual source code, not all UML diagrams come with a precisely defined execution which is generated from the models automatically. However, semantics and thus, code generation is hindered. In this paper, an practical experiences have shown that language-specific adap- implementation of the Action Language for Foundational UML tations to the generated source code are frequently necessary. (Alf) standard is presented, which allows for textual modeling In EMF, for instance, only structure is modeled by means of of software systems.
    [Show full text]
  • The Convergence of Modeling and Programming
    The Convergence of Modeling and Programming: Facilitating the Representation of Attributes and Associations in the Umple Model-Oriented Programming Language by Andrew Forward PhD Thesis Presented to the Faculty of Graduate and Postdoctoral Studies in partial fulfillment of the requirements for the degree Doctor of Philosophy (Computer Science1) Ottawa-Carleton Institute for Computer Science School of Information Technology and Engineering University of Ottawa Ottawa, Ontario, K1N 6N5 Canada © Andrew Forward, 2010 1 The Ph.D. program in Computer Science is a joint program with Carleton University, administered by the Ottawa Carleton Institute for Computer Science Acknowledgements A very special, and well-deserved, thank you to the following: a) Dr. Timothy C. Lethbridge. Tim has been a mentor of mine for several years, first as one of my undergraduate professors, later as my Master’s supervisor. Tim has again helped to shape my approach to software engineering, research and academics during my journey as a PhD candidate. b) The Complexity Reduction in Software Engineering (CRUISE) group and in particular Omar Badreddin and Julie Filion. Our weekly meetings, work with IBM, and the collaboration with the development of Umple were of great help. c) My family and friends. Thank you and much love Ayana; your support during this endeavor was much appreciated despite the occasional teasing about me still being in school. To my mom (and editor) Jayne, my dad Bill, my sister Allison and her husband Dennis. And, to my friends Neil, Roy, Van, Rob, Pat, and Ernesto – your help will be forever recorded in my work. Finally a special note to Ryan Lowe, a fellow Software Engineer that helped to keep my work grounded during our lengthy discussion about software development – I will miss you greatly.
    [Show full text]
  • Umple Tutorial: Models 2020
    Umple Tutorial: Models 2020 Timothy C. Lethbridge, I.S.P, P.Eng. University of Ottawa, Canada Timothy.Lethbridge@ uottawa.ca http://www.umple.org Umple: Simple, Ample, UML Programming Language Open source textual modeling tool and code generator • Adds modeling to Java,. C++, PHP • A sample of features —Referential integrity on associations —Code generation for patterns —Blending of conventional code with models —Infinitely nested state machines, with concurrency —Separation of concerns for models: mixins, traits, mixsets, aspects Tools • Command line compiler • Web-based tool (UmpleOnline) for demos and education • Plugins for Eclipse and other tools Models T3 Tutorial: Umple - October 2020 2 What Are we Going to Learn About in This Tutorial? What Will You Be Able To Do? • Modeling using class diagrams —AttriButes, Associations, Methods, Patterns, Constraints • Modeling using state diagrams —States, Events, Transitions, Guards, Nesting, Actions, Activities —Concurrency • Separation of Concerns in Models —Mixins, Traits, Aspects, Mixsets • Practice with a examples focusing on state machines and product lines • Building a complete system in Umple Models T3 Tutorial: Umple - October 2020 3 What Technology Will You Need? As a minimum: Any web browser. For a richer command-line experience • A computer (laptop) with Java 8-14 JDK • Mac and Linux are the easiest platforms, but Windows also will work • Download Umple Jar at http://dl.umple.org You can also run Umple in Docker: http://docker.umple.org Models T3 Tutorial: Umple - October 2020 4
    [Show full text]
  • Textual, Executable, Translatable UML⋆
    Textual, executable, translatable UML? Gergely D´evai, G´abor Ferenc Kov´acs, and Ad´amAncsin´ E¨otv¨osLor´andUniversity, Faculty of Informatics, Budapest, Hungary, fdeva,koguaai,[email protected] Abstract. This paper advocates the application of language embedding for executable UML modeling. In particular, txtUML is presented, a Java API and library to build UML models using Java syntax, then run and debug them by reusing the Java runtime environment and existing de- buggers. Models can be visualized using the Papyrus editor of the Eclipse Modeling Framework and compiled to implementation languages. The paper motivates this solution, gives an overview of the language API, visualization and model compilation. Finally, implementation de- tails involving Java threads, reflection and AspectJ are presented. Keywords: executable modeling, language embedding, UML 1 Introduction Executable modeling aims at models that are completely independent of the ex- ecution platform and implementation language, and can be executed on model- level. This way models can be tested and debugged in early stages of the devel- opment process, long before every piece is in place for building and executing the software on the real target platform. Executable and platform-independent UML modeling changes the landscape of software development tools even more than mainstream modeling: graphical model editors instead of text editors, model compare and merge instead of line based compare and merge, debuggers with graphical animations instead of de- buggers for textual programs, etc. Figure 1 depicts the many different use cases such a toolset is responsible for. Models are usually persisted in a format that is hard or impossible to edit directly, therefore any kind of access to the model is dependent on different features of the modeling toolset.
    [Show full text]
  • Capstone Software Engineering Students Can Develop a High-Quality Complex System: a Case Study with Umple
    Proceedings 2019 Canadian Engineering Education Association (CEEA-ACEG19) Conference CAPSTONE SOFTWARE ENGINEERING STUDENTS CAN DEVELOP A HIGH-QUALITY COMPLEX SYSTEM: A CASE STUDY WITH UMPLE Timothy C. Lethbridge University of Ottawa [email protected] Abstract – Umple is an open-source programming UmpLe can be run OnLine, in EcLipse, in VisuaL Studio technology developed almost entirely by students, the Code and in severaL other tooLs. It can aLso be used in a majority of whom were working on it as their capstone classic manner as a command-line tool. project through a program called UCOSP. We describe UmpLe is targeted for educators who teach modeling our development process for Umple that has provided a [3][4], for students, and for open source developers who rich educational experience for the students, while at the want to buiLd systems that require low coding effort. The same time continually improving Umple’s quality. We core idea is that the high-level abstractions reduce the also describe features of Umple that have been designed amount of boiLerplate (repetitive) code that needs to be to facilitate its use in teaching software engineering. written, whiLe at the same time enabLing deveLopers and students to think at a higher level and to visualize their Keywords: Capstone project, open source, software code. UmpLe is a textuaL Language, but its high-level engineering, colLaboration, modeL-driven development abstractions can also be rendered and edited as graphs. UmpLe’s online user manual [5], if printed, amounts to 1. INTRODUCTION 300 pages. The OpenHub code analysis system [6] points out that 102 people have contributed a miLLion Lines of We describe our approach that has enabled successive code to UmpLe and suggests they have spent 286 person- groups of students to engineer and evolve a complex, years of effort on it based on its apparent complexity.
    [Show full text]
  • Applying Umple to the Rover Control Challenge Problem: a Case Study in Model-Driven Engineering
    Applying Umple to the rover control challenge problem: A case study in model-driven engineering Timothy C. Lethbridge and Abdulaziz Algablan Electrical Engineering and Computer Science, University of Ottawa, K1N 6N5, Canada [email protected], [email protected] Abstract. We demonstrate the use of the textual modeling language called Um- ple on a software modeling challenge problem that requires participants to create an executable model of a robotic rover that must follow another rover at a safe distance. We used a wide variety of features of Umple in the solution, including class models, state machines, aspects, and mixsets (feature models). We imple- mented two separate solutions to the problem. Our first solution, in which pulses of full power of varying lengths alternate with direction changes, performs sig- nificantly better than our second solution in which power and direction are blended together and varied in amplitude. Overall Umple proved very versatile at exploring various dimensions of this problem. Keywords: Umple, autonomous control, mixins, state machines, case study. 1! Introduction In this paper we present a solution, written in Umple, to the MDETools 2018 workshop challenge problem [1]. The problem involves arranging for a rover to follow a randomly moving leader rover in a simulated environment. The challenge is to create a model that can generate code whereby the follower stays neither too far (15 simulation distance units by default) from the leader nor too near (12 units) to it, and turns appropriately to follow it. Follower speed and direction primarily has to be controlled by independently varying power to left- or right-side sets of wheels; braking is also available.
    [Show full text]
  • Umple: an Open-Source Tool for Easy-To-Use Modeling, Analysis, and Code Generation
    Umple: An Open-Source Tool for Easy-To-Use Modeling, Analysis, and Code Generation Timothy C. Lethbridge School of Electrical Engineering and Computer Science University of Ottawa, Canada K1N 6N5 [email protected] Abstract. We demonstrate the Umple technology, which allows software de- velopers to blend abstract models, including class-, state- and composite struc- ture diagrams textually into their Java, C++ or PhP code. Umple is targeted at developers who prefer textual programming but also want additional abstrac- tions in order to simplify their software and improve its quality. Umple devel- opment has involved over 60 people, mostly at Canadian and US universities, and is used to develop itself. Several systems have been umplified – converted into Umple – thus raising their abstraction and reducing code volume. The ac- companying video can be found at http://youtu.be/xD-zTpB_zyQ . Keywords: Code generation, Textual Modeling, Umple, UML, State Machines 1 Introduction Umple is a multi-faceted technology allowing users to integrate modeling into soft- ware development straightforwardly. It supports modeling using class diagrams, state machines and composite structure diagrams, and provides a textual syntax for these that can be blended into any C-family language such as Java or C++. The resulting system can consist completely of modeling abstractions, completely of base pro- gramming language code, or a blend of either. The Umple textual form is the ‘master’ code for the system. Umple therefore renders the distinction between model and code somewhat moot. Umple can display and update model diagrams as text is edited, and allows chang- es to diagrams to automatically change the Umple text.
    [Show full text]
  • Exploring a Model-Oriented and Executable Syntax for UML Attributes
    Exploring a Model-Oriented and Executable Syntax for UML Attributes Omar Badreddin, Andrew Forward, Timothy C. Lethbridge1 Abstract Implementing UML attributes directly in an object-oriented language may not appear to be complex, since such languages already support member variables. The distinction arises when considering the differences between modelling a class and implementing it. In addition to representing attributes, member variables can also represent association ends and internal data including counters, caching, or sharing of local data. Attributes in models also support additional characteristics such as being unique, immutable, or subject to lazy instantiation. In this paper we present modeling characteristics of attributes from first principles and investigate how attributes are handled in several open-source systems. We look code-generation of attributes by various UML tools. Finally, we present our own Umple language along with its code generation patterns for attributes, using Java as the target language. Key words Attributes, UML, Model Driven Design, Code Generation, Umple, Model- Oriented Programming Language. 1 Introduction A UML attribute is a simple property of an object. For example, a Student object might have a studentNumber and a name. Attributes should be contrasted with associations (and association ends), which represent relationships among objects. Constraints can be applied to attributes; for example, they can be immutable or have a limited range. In translating UML attributes into languages like Java it is common to generate accessor (get and set) methods to manage access. Omar Badreddin, Andrew Forward, Timothy C. Lethbridge School of Electrical Engineering and Computer Science, University of Ottawa, Canada K1N 6N5 e-mail: [email protected], [email protected], [email protected] In this paper, we study the use of attributes in several systems and discuss how to represent attributes in a model-oriented language called Umple.
    [Show full text]
  • Umple: Bridging the Code-Model Divide
    1 Umple: Bridging the Code-Model Divide Timothy C. Lethbridge, Andrew Forward, Dusan Brestovansky School of Information Technology and Engineering, University of Ottawa {tcl,aforward}@site.uottawa.ca, [email protected] Abstract Finally, we present some case studies that demonstrate the value of the Umple approach. We present an approach to object-oriented software engineering intended to reduce the ever-present 2. Motivations tension between model-centric and code-centric developers. The former prefer to model visually and Our desire to develop Umple arose for two main generate code, while the latter see source code as the reasons. We address each of these in the following only important software artifact. The core of the subsections. Together, these motivations naturally led Umple approach is to add UML abstractions such as us to want to develop Umple. associations directly into a high-level programming language – our current implementation works with 2.1 Prevalence of the code-centric approach in Java. With Umple, the developer can work software engineering: Lack of adoption of interchangeably with UML diagrams and Umple code; modeling these are just views of the same thing. We describe the basics of Umple as well as the tools used to work with Many software engineering researchers and opinion it; these include plugins for Eclipse and Rational leaders describe what they see as the obvious benefits Software Modeler. To demonstrate the benefits of the of modeling. Principal among these is enabling approach, we present as case studies a few systems we developers to work at a higher level of abstraction [1]. have developed in Umple, in particular the functional However, when one interacts with developers in real layers of airline reservation, elevator control and companies, is clear that the overwhelming majority of timesheet management systems.
    [Show full text]
  • Model-Based Systems Engineering: Some Messages for Digital
    Model-Based Systems Engineering: Some Messages for Digital Transformation in Government Timothy C. Lethbridge, PhD, P. Eng, ISP, FCIPS [email protected] http://www.eecs.uottawa.ca/~tcl Who am I? Professor of Software Engineering at uOttawa • Research: code generation, usability, enterprise architecture • Textbook author: Software Engineering Professional societies • CIPS; Board member, Former head of Accreditation Council • Senior member of IEEE, ACM • P.Eng. Industrial Experience • Mid 1980’s Government of New Brunswick • Later 1980’s BNR (Nortel) • 1990’s: Research/consulting with Boeing, Mitel, Federal Government • 2000’s: Research with IBM, GM, KDM Analytics 17:09 Lethbridge: Model-Based Systems Engineering 2 What I will talk about Key problems we need to address • Government is a complex system of systems Ways to help make digital government systems more successful: —Use systems thinking (consider interconnectedness, interactions, patterns) —Generate systems from models —Be agile —Attract staff with the right skills —”Buy, don’t build” is not always the right answer - Better balance procuring/developing —Think in terms of user experience (UX) 17:09 Lethbridge: Model-Based Systems Engineering 3 System A logical entity • having a set of definable responsibilities or objectives, • and which can be divided into interacting components or subsystems. Hardware, software, social, natural or a combination. Natural systems have evolved to survive in a changing environment Artificial systems must be designed to achieve their goal
    [Show full text]
  • Guidelines for Accessible Textual UML Modeling Notations This Is A
    This is a preliminary version of the paper that will appear in the proceedings of ICCHP'16 published by Springer. Guidelines for Accessible Textual UML Modeling Notations Vanessa Petrausch1, Stephan Seifermann2 and Karin M¨uller1 1 Karlsruhe Institute of Technology, Germany fvanessa.petrausch, [email protected] 2 FZI Research Center for Information Technology, Germany [email protected] Abstract. Textual representations of UML are basic requisites to make UML modeling accessible for visually impaired people. The accessibility, however, varies depending on the concrete realization. Constructing and rating accessible notations is challenging because the notation has to consider requirements of various assistive techniques including screen readers with audio and/or braille output. Neither accessibility metrics for existing textual notations nor comprehensive guidelines for constructing such notations exist. To bridge this gap, we design an interview for rating the accessibility of notations for UML class diagrams and conduct it with six participants for four textual notations. We use the results and related work to derive general design guidelines for accessible textual UML notations. The guidelines allow constructing accessible notations without deep understanding of assistive technologies and can serve as a benchmark for existing notations. Keywords: UML, Textual Notation, Survey, Accessibility, Formal Mod- eling, Language Design, Guidelines 1 Introduction Modeling is frequently used in the software engineering process to describe var- ious aspects of a system in an abstract way. The Unified Modeling Language (UML) is the most commonly used modeling language. It provides a complete graphical notation but only patchy textual notations for parts of diagram types. The lack of a standardized accessible notation impedes equal participation of visually impaired software developers and engineers even if the demand for IT experts is high.
    [Show full text]
  • Component-Based Modeling in Umple
    Component-based Modeling in Umple Mahmoud Husseini Orabi, Ahmed Husseini Orabi and Timothy C. Lethbridge School of Electrical Engineering and Computer Science, University of Ottawa, 800 King Edward Avenue, Ottawa, Canada Keywords: Umple, Active Object, Composite Structure, UML. Abstract: Modelling tools provide weak or no support for the rich semantics of composite structure, such as enforcing connection constraints and maintaining referential integrity. Tools that generate code from composite structure typically depend on excessive and complex internal class representations such as Actor or BasePort. In this paper, we present easy-to-comprehend syntax describing composite structure in Umple. We describe a novel protocol-free approach that dynamically extracts communication protocols as a way to ease component-based modelling, and lead to concise and optimized code generation. We outline Umple composite structure features, and the related code generation patterns that resolve difficulties around connections and the integrity of multiplicity constraints. 1 INTRODUCTION Motivated by the above, we show how we extend Umple, an open-source tool, to support composite Composite structure development refers to the structure and overcomes such limitations. implementation of concurrent components that Umple is a text- and model-oriented interact and communicate via ports and connectors programming language that allows for generative (Orabi, Orabi, & Lethbridge, 2016). programming using many target languages such as In UML, interactions among components are C++, Java, and PHP (Badreddin, Forward, & handled as messages and signals. There are two Lethbridge, 2014; Badreddin, Lethbridge, & message-passing actions, one-way call Forward, 2014; Lethbridge, Abdelzad, Husseini (asynchronous call) and calls that block waiting for a Orabi, Husseini Orabi, & Adesina, 2016; Orabi et al., response (synchronous call).
    [Show full text]