SlideShare uma empresa Scribd logo
1 de 1
Baixar para ler offline
Test-driven development and Umple
UCOSP - Winter 2014
Tyler McConnell, supervised by Dr. Nora Znotinas,
CP494: Directed Research Project II, Wilfrid Laurier University
INTRODUCTION TESTING IN UMPLE
This poster has been completed as part of
the requirements for the course CP494:
Directed Research Project II. For my
directed research project, I have had the
privilege of partaking in the
Undergraduate Capstone Open-Source
Projects (UCOSP) program.
Through this program, I have worked on
the open-source software project Umple
with a distributed team of software
developers from universities all over the
world. The UCOSP program has provided
me with real-world development
experience and has introduced me to the
challenges of software development with
a distributed team.
Anyone interested in the UCOSP program
should contact the Physics & Computer
Science faculty office for more
information.
ADDITIONAL INFO
Test-driven development (TDD) is a software
development process with two main rules:
1. Don’t write a new line of code unless you have a
failing automated test.
2. Eliminate duplication.
These two rules imply an order to the tasks of
programming in a TDD environment:
• Developer writes an (initially failing) automated
test case that defines the desired improvement
or new functionality
• Developer writes the minimum code required to
pass the automated test case
• Developer refactors the new code to acceptable
standards
The TDD mantra, “Red/green/refactor” is visually
depicted as a repetitive process in Figure 1 to the
right.
Test-driven development is a very common
development process for open-source software
projects, especially those which adhere to Agile
principles or which use continuous integration.
All development for the open-source UML
programming language, Umple, is done using TDD
principles. This decision leads to more manageable,
understandable code.
There are several levels of testing in the Umple compiler.
Testing also exists for all of the non-compiler
components. The primary levels of compiler testing are:
• Parser tests: verify that a construct parses correctly
• Metamodel tests: check that the metamodel is
populated correctly by the various umple constructs
• Template tests: verify that the generated output in
languages like Java is as expected
• Testbed tests: verify that compiled code that
generates languages such as Java can then compile
under the language compiler
• User manual tests: verify that examples in the user
manual can properly run
The separation of testing levels comes naturally from the
hierarchal components of Umple’s architecture.
Figure 2 shows some code snippets from the Umple
code base. ConstraintTest exists at the metamodel level.
TDD works harmoniously with the collaborative and
distributed way in which Umple is developed.
Umple is developed using a continuous integration
process, which works very well with TDD. The
continuous integration process makes it so that any
changes committed to the Umple source repository
are immediately tested to ensure that they do not
negatively effect the build.
Figure 3 below shows an example of the continuous
integration process which relies on TDD. Changes
are committed to the code base until an error is
detected by the build process. Once an error is
detected, action must be taken to resolve that error
before any other new commits can be integrated
into the source repository.
By writing automated tests first during
development, we can:
• Fully imagine and plan our changes before
actually implementing them
• Ensure the changes produce expected
behaviours
• Ensure the changes don’t affect other areas of
the source code
• Potentially catch errors which we may have
missed without tests
TDD & UMPLE
CONCLUSIONS
The TDD process integrates very well with the
distributed nature of development on an open-
source project. By adhering to TDD principles,
contributors to the Umple project are ensuring that
the code is reliable and maintainable, and are
making it easier for new developers to contribute in
the future.
Figure 3. Example of continuous integration and test-driven development relationship.
Figure 1. Visual depiction of order of TDD tasks.
TEST-DRIVEN DEVELOPMENT (TDD)
UMPLE
Umple is a language used for both object-oriented
programming and modeling with class and state
diagrams.
The name Umple is a portmanteau of “UML”,
“ample”, and “programming language”. This is
meant to convey that Umple provides ample
features to extend programming languages with
UML capabilities, such as Java, PHP, or Ruby. Code
can also be generated in these mentioned
languages from a source Umple file.
Created in 2008, Umple was open-sourced in 2011
when it was released publicly on Google Code.
/*
* A pared-down Constraint object
*/
class Constraint {
isA CodeBlock;
format = "allParameterClosed";
String inject = "";
CodeTranslator gen = null;
boolean negated = false;
String code = { StringFormatter.format(getGen().translate(
(getNegated()?"Not":"")+getFormat(),this),
getInject())};
}
public class ConstraintTest {
Constraint constraint;
@Before
public void setUp() {
constraint = new Constraint();
constraint.addExpression(new ConstraintVariable("ATTRIBUTE","foo"));
constraint.setInject("bar");
}
@Test
public void getCode_javaGen() {
constraint.setGen(new JavaGenerator());
String expected = "if (foo)n{n barn}";
assertEquals(expected, constraint.getCode());
}
@Test
public void getCode_rubyGen() {
constraint.setGen(new RubyGenerator());
String expected = "if @foo thenn barnend";
assertEquals(expected, constraint.getCode());
}
…
}
Figure 2. Example Constraint.ump file
and its corresponding test class.

Mais conteúdo relacionado

Mais procurados

Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolIvan Ruchkin
 
Testing Neural Program Analyzers (ASE-LBR 2019)
Testing Neural Program Analyzers (ASE-LBR 2019)Testing Neural Program Analyzers (ASE-LBR 2019)
Testing Neural Program Analyzers (ASE-LBR 2019)Rafiqul Rabin
 
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...Daniel G. Strüber
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsDharmalingam Ganesan
 
Generate Test Cases for GCC Compilers (ASE-LBR 2019)
Generate Test Cases for GCC Compilers (ASE-LBR 2019)Generate Test Cases for GCC Compilers (ASE-LBR 2019)
Generate Test Cases for GCC Compilers (ASE-LBR 2019)Rafiqul Rabin
 
SE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitSE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitAmr E. Mohamed
 
SE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingSE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingAmr E. Mohamed
 
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case StudyModel-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case StudyDharmalingam Ganesan
 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveModel-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveDharmalingam Ganesan
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexitynikshaikh786
 
Integrating the compiler with unit testing
Integrating the compiler with unit testingIntegrating the compiler with unit testing
Integrating the compiler with unit testingSimon Belak
 
The Impact of Test Ownership and Team Structure on the Reliability and Effect...
The Impact of Test Ownership and Team Structure on the Reliability and Effect...The Impact of Test Ownership and Team Structure on the Reliability and Effect...
The Impact of Test Ownership and Team Structure on the Reliability and Effect...Kim Herzig
 
Issre2014 test defectprediction
Issre2014 test defectpredictionIssre2014 test defectprediction
Issre2014 test defectpredictionKim Herzig
 
Code: from Procedural to Object Oriented
Code: from Procedural to Object OrientedCode: from Procedural to Object Oriented
Code: from Procedural to Object Orientedkleinron
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesArghodeepPaul
 

Mais procurados (19)

Data Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification ToolData Generation with PROSPECT: a Probability Specification Tool
Data Generation with PROSPECT: a Probability Specification Tool
 
50120140502017
5012014050201750120140502017
50120140502017
 
Testing Neural Program Analyzers (ASE-LBR 2019)
Testing Neural Program Analyzers (ASE-LBR 2019)Testing Neural Program Analyzers (ASE-LBR 2019)
Testing Neural Program Analyzers (ASE-LBR 2019)
 
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...
Comparing Reuse Mechanisms for Model Transformation Languages: Design for an ...
 
Automated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from ModelsAutomated Test Case Generation and Execution from Models
Automated Test Case Generation and Execution from Models
 
Generate Test Cases for GCC Compilers (ASE-LBR 2019)
Generate Test Cases for GCC Compilers (ASE-LBR 2019)Generate Test Cases for GCC Compilers (ASE-LBR 2019)
Generate Test Cases for GCC Compilers (ASE-LBR 2019)
 
SE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and JunitSE2_Lec 21_ TDD and Junit
SE2_Lec 21_ TDD and Junit
 
SE2_Lec 20_Software Testing
SE2_Lec 20_Software TestingSE2_Lec 20_Software Testing
SE2_Lec 20_Software Testing
 
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case StudyModel-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
Model-based Testing using Microsoft’s Spec Explorer Tool: A Case Study
 
Model-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight ExecutiveModel-based Testing of a Software Bus - Applied on Core Flight Executive
Model-based Testing of a Software Bus - Applied on Core Flight Executive
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Calculation of Cyclomatic complexity
Calculation of Cyclomatic complexityCalculation of Cyclomatic complexity
Calculation of Cyclomatic complexity
 
Integrating the compiler with unit testing
Integrating the compiler with unit testingIntegrating the compiler with unit testing
Integrating the compiler with unit testing
 
The Impact of Test Ownership and Team Structure on the Reliability and Effect...
The Impact of Test Ownership and Team Structure on the Reliability and Effect...The Impact of Test Ownership and Team Structure on the Reliability and Effect...
The Impact of Test Ownership and Team Structure on the Reliability and Effect...
 
Issre2014 test defectprediction
Issre2014 test defectpredictionIssre2014 test defectprediction
Issre2014 test defectprediction
 
Code: from Procedural to Object Oriented
Code: from Procedural to Object OrientedCode: from Procedural to Object Oriented
Code: from Procedural to Object Oriented
 
01 overview
01 overview01 overview
01 overview
 
Algorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notesAlgorithm pseudocode flowchart program notes
Algorithm pseudocode flowchart program notes
 
Rv11
Rv11Rv11
Rv11
 

Semelhante a Test-drive development and Umple

Test-driven development and Umple
Test-driven development and UmpleTest-driven development and Umple
Test-driven development and Umpletylerjdmcconnell
 
Test-Driven-Development.pptx
Test-Driven-Development.pptxTest-Driven-Development.pptx
Test-Driven-Development.pptxdheeraj438799
 
Increasing Quality with DevOps
Increasing Quality with DevOpsIncreasing Quality with DevOps
Increasing Quality with DevOpsCoveros, Inc.
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answersHopeTutors1
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure rupeshchanchal
 
Qualidade de Software em zOS usando IBM Debug Tool e RDz
Qualidade de Software em zOS usando IBM Debug Tool e RDzQualidade de Software em zOS usando IBM Debug Tool e RDz
Qualidade de Software em zOS usando IBM Debug Tool e RDzPaulo Batuta
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Hong Le Van
 
The Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelFThe Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelFMarkus Voelter
 
Test Driven Development:Unit Testing, Dependency Injection, Mocking
Test Driven Development:Unit Testing, Dependency Injection, MockingTest Driven Development:Unit Testing, Dependency Injection, Mocking
Test Driven Development:Unit Testing, Dependency Injection, Mockingmrjawright
 
Test driven development
Test driven developmentTest driven development
Test driven developmentHarry Potter
 
Test driven development
Test driven developmentTest driven development
Test driven developmentLuis Goldster
 
Test driven development
Test driven developmentTest driven development
Test driven developmentTony Nguyen
 
Test driven development
Test driven developmentTest driven development
Test driven developmentYoung Alista
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJames Wong
 
Test driven development
Test driven developmentTest driven development
Test driven developmentFraboni Ec
 
CV_ShivamChhatwalupdated
CV_ShivamChhatwalupdatedCV_ShivamChhatwalupdated
CV_ShivamChhatwalupdatedShivam Chhatwal
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship ChecklistRyan Polk
 

Semelhante a Test-drive development and Umple (20)

Test-driven development and Umple
Test-driven development and UmpleTest-driven development and Umple
Test-driven development and Umple
 
Test-Driven-Development.pptx
Test-Driven-Development.pptxTest-Driven-Development.pptx
Test-Driven-Development.pptx
 
Increasing Quality with DevOps
Increasing Quality with DevOpsIncreasing Quality with DevOps
Increasing Quality with DevOps
 
DevOps interview questions and answers
DevOps interview questions and answersDevOps interview questions and answers
DevOps interview questions and answers
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Qualidade de Software em zOS usando IBM Debug Tool e RDz
Qualidade de Software em zOS usando IBM Debug Tool e RDzQualidade de Software em zOS usando IBM Debug Tool e RDz
Qualidade de Software em zOS usando IBM Debug Tool e RDz
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
 
Munit_in_mule_naveen
Munit_in_mule_naveenMunit_in_mule_naveen
Munit_in_mule_naveen
 
The Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelFThe Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelF
 
Test Driven Development:Unit Testing, Dependency Injection, Mocking
Test Driven Development:Unit Testing, Dependency Injection, MockingTest Driven Development:Unit Testing, Dependency Injection, Mocking
Test Driven Development:Unit Testing, Dependency Injection, Mocking
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
CV_ShivamChhatwalupdated
CV_ShivamChhatwalupdatedCV_ShivamChhatwalupdated
CV_ShivamChhatwalupdated
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship Checklist
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 

Último

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 

Último (20)

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 

Test-drive development and Umple

  • 1. Test-driven development and Umple UCOSP - Winter 2014 Tyler McConnell, supervised by Dr. Nora Znotinas, CP494: Directed Research Project II, Wilfrid Laurier University INTRODUCTION TESTING IN UMPLE This poster has been completed as part of the requirements for the course CP494: Directed Research Project II. For my directed research project, I have had the privilege of partaking in the Undergraduate Capstone Open-Source Projects (UCOSP) program. Through this program, I have worked on the open-source software project Umple with a distributed team of software developers from universities all over the world. The UCOSP program has provided me with real-world development experience and has introduced me to the challenges of software development with a distributed team. Anyone interested in the UCOSP program should contact the Physics & Computer Science faculty office for more information. ADDITIONAL INFO Test-driven development (TDD) is a software development process with two main rules: 1. Don’t write a new line of code unless you have a failing automated test. 2. Eliminate duplication. These two rules imply an order to the tasks of programming in a TDD environment: • Developer writes an (initially failing) automated test case that defines the desired improvement or new functionality • Developer writes the minimum code required to pass the automated test case • Developer refactors the new code to acceptable standards The TDD mantra, “Red/green/refactor” is visually depicted as a repetitive process in Figure 1 to the right. Test-driven development is a very common development process for open-source software projects, especially those which adhere to Agile principles or which use continuous integration. All development for the open-source UML programming language, Umple, is done using TDD principles. This decision leads to more manageable, understandable code. There are several levels of testing in the Umple compiler. Testing also exists for all of the non-compiler components. The primary levels of compiler testing are: • Parser tests: verify that a construct parses correctly • Metamodel tests: check that the metamodel is populated correctly by the various umple constructs • Template tests: verify that the generated output in languages like Java is as expected • Testbed tests: verify that compiled code that generates languages such as Java can then compile under the language compiler • User manual tests: verify that examples in the user manual can properly run The separation of testing levels comes naturally from the hierarchal components of Umple’s architecture. Figure 2 shows some code snippets from the Umple code base. ConstraintTest exists at the metamodel level. TDD works harmoniously with the collaborative and distributed way in which Umple is developed. Umple is developed using a continuous integration process, which works very well with TDD. The continuous integration process makes it so that any changes committed to the Umple source repository are immediately tested to ensure that they do not negatively effect the build. Figure 3 below shows an example of the continuous integration process which relies on TDD. Changes are committed to the code base until an error is detected by the build process. Once an error is detected, action must be taken to resolve that error before any other new commits can be integrated into the source repository. By writing automated tests first during development, we can: • Fully imagine and plan our changes before actually implementing them • Ensure the changes produce expected behaviours • Ensure the changes don’t affect other areas of the source code • Potentially catch errors which we may have missed without tests TDD & UMPLE CONCLUSIONS The TDD process integrates very well with the distributed nature of development on an open- source project. By adhering to TDD principles, contributors to the Umple project are ensuring that the code is reliable and maintainable, and are making it easier for new developers to contribute in the future. Figure 3. Example of continuous integration and test-driven development relationship. Figure 1. Visual depiction of order of TDD tasks. TEST-DRIVEN DEVELOPMENT (TDD) UMPLE Umple is a language used for both object-oriented programming and modeling with class and state diagrams. The name Umple is a portmanteau of “UML”, “ample”, and “programming language”. This is meant to convey that Umple provides ample features to extend programming languages with UML capabilities, such as Java, PHP, or Ruby. Code can also be generated in these mentioned languages from a source Umple file. Created in 2008, Umple was open-sourced in 2011 when it was released publicly on Google Code. /* * A pared-down Constraint object */ class Constraint { isA CodeBlock; format = "allParameterClosed"; String inject = ""; CodeTranslator gen = null; boolean negated = false; String code = { StringFormatter.format(getGen().translate( (getNegated()?"Not":"")+getFormat(),this), getInject())}; } public class ConstraintTest { Constraint constraint; @Before public void setUp() { constraint = new Constraint(); constraint.addExpression(new ConstraintVariable("ATTRIBUTE","foo")); constraint.setInject("bar"); } @Test public void getCode_javaGen() { constraint.setGen(new JavaGenerator()); String expected = "if (foo)n{n barn}"; assertEquals(expected, constraint.getCode()); } @Test public void getCode_rubyGen() { constraint.setGen(new RubyGenerator()); String expected = "if @foo thenn barnend"; assertEquals(expected, constraint.getCode()); } … } Figure 2. Example Constraint.ump file and its corresponding test class.