SlideShare a Scribd company logo
1 of 19
Download to read offline
MoDELS 2016 Advanced Model Management with EpsilonAdvanced Model Management with EpsilonMoDELS 2016
Developing a new Epsilon
Language through Annotations:
TestLang
Antonio Garcia-Dominguez
@antoniogado
1
MoDELS 2016 Advanced Model Management with Epsilon
When should I use annotations?
• One of the Epsilon languages does almost
everything that you need, but…
• … you need to add a thin layer of
orchestration logic on top of it.
• Some examples:
– Unit testing (EOL + orchestration)
– Model generation (EOL + ...)
– Model mutation (EOL/ETL + ...)
– Categorized model validation (EVL + ...)
– Model-driven game engine...
2
MoDELS 2016 Advanced Model Management with Epsilon
Example TestLang script (v1)
var rnd = new Native('java.util.Random');
@test
operation allInstancesWorks() {
if (Class.all.size != 6) { “FAILED aiw”.println(); }
}
@test
$times 10 * 10
operation randomTest() {
var b = 2 + rnd.nextInt(9); var e = rnd.nextInt(10);
if (slowPow(b, e) != fastPow(b, e)) { “FAILED rt”.println(); }
} 3
MoDELS 2016 Advanced Model Management with Epsilon
Overview
• TestLang is divided into:
– org.eclipse.epsilon.examples.testlang.engine
implements the language (Eclipse-agnostic)
– org.eclipse.epsilon.examples.testlang.dt
provides Eclipse dev tools
• Sources here:
– https://git.eclipse.org/c/epsilon/org.eclipse.e
psilon.git/tree/examples
4
MoDELS 2016 Advanced Model Management with Epsilon
TESTLANG EXECUTION ENGINE
Implementing a simple unit testing language on top of EOL
5
MoDELS 2016 Advanced Model Management with Epsilon
TestLangModule: execution engine
● Inherits from EolModule, overrides methods
○ execute(): interprets @test and $times
● 68 lines of Java code
6
MoDELS 2016 Advanced Model Management with Epsilon
AnnotatableModuleElement
• Superclass of anything that can be annotated
– EOL operations
– ETL rules
– EVL contexts and constraints...
• Two types of annotations supported:
– Simple: “@test a” - constant value
– Executable: “$test self.x * 2” - uses expression
– Repeated annotations are allowed
• Provides methods for handling annotations
7
MoDELS 2016 Advanced Model Management with Epsilon
Example TestLang script (v2)
var rnd = new Native('java.util.Random');
@test
operation allInstancesWorks() { areEqual(6, Class.all.size); }
@test
$times 10 * 10
operation randomTest() {
var base = 2 + rnd.nextInt(9);
var exp = rnd.nextInt(10);
areEqual(slowPow(base, exp), fastPow(base, exp));
}
8
MoDELS 2016 Advanced Model Management with Epsilon
TestLangModule: add areEqual
● By overriding prepareContext(), we can add
task-specific operations/variables
● Operations provided by OperationContributor
9
MoDELS 2016 Advanced Model Management with Epsilon
Operation contributors
• When processing x.f(args):
– contributesTo(x) must return true
– f(args) must be a method of the contributor
• Contextless operations (e.g. “areEqual”)
receive a special value in contributesTo:
– EolNoType.NoInstance
10
MoDELS 2016 Advanced Model Management with Epsilon
TESTLANG ECLIPSE-BASED
DEVELOPER TOOLS
Integration of TestLang into Eclipse
11
MoDELS 2016 Advanced Model Management with Epsilon 12
MoDELS 2016 Advanced Model Management with Epsilon
TestLang developer tools
• Same approach as the engine: inherit from
common.dt / eol.dt and refine as desired
– 65 lines of Java code
• plugin.xml (49 lines):
– Integrates all our subclasses
– Associates .eolt with the “New TestLang” wizard
– Reuses EOL editor/debugger for .eolt files
– Provides a custom icon for .eolt launch configs
• In short: mostly plumbing!
13
MoDELS 2016 Advanced Model Management with Epsilon
TestLang editor: same as EOL
14
MoDELS 2016 Advanced Model Management with Epsilon
TestLang launch facilities
15
MoDELS 2016 Advanced Model Management with Epsilon
Summary
• Showed how to implement a unit testing
language on top of EOL:
– @test tags an operation as a test case
– $times allows for repeating the same test
• Reuses all EOL tooling:
– Editor and debugger “for free”
– Can work with EMF, CSV, BibTeX, XML, ...
• < 200 lines of code: 133 Java, 49 XML
16
MoDELS 2016 Advanced Model Management with EpsilonAdvanced Model Management with EpsilonMoDELS 2016
Questions?
@antoniogado
17
MoDELS 2016 Advanced Model Management with Epsilon
Other examples
@operator
$condition self.isKindOf(Addition)
operation add2sub() {
// … return Subtraction
}
@operator
$condition self.isKindOf(BooleanLiteral)
operation flipLiteral() {
// … return negated BooleanLiteral
}
For a model mutation language:
18
MoDELS 2016 Advanced Model Management with Epsilon
Other examples
@enemy
@after blinky
@sprite red_ghost.png
operation inky(player, enemies) {
// … compute which way to turn next …
// … compute speed …
}
In a model-driven game engine, operations could provide
behavior for AI actors:
The language can provide built-in operations for
common/expensive tasks (e.g. pathfinding algorithms).
19

More Related Content

What's hot

Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New FeaturesNaveen Hegde
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In PracticeMichiel Borkent
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8icarter09
 
Lambda Expressions in Java
Lambda Expressions in JavaLambda Expressions in Java
Lambda Expressions in JavaErhan Bagdemir
 
A DSL for Model Mutation and its Applications to Different Domains
A DSL for Model Mutation and its Applications to Different DomainsA DSL for Model Mutation and its Applications to Different Domains
A DSL for Model Mutation and its Applications to Different DomainsPablo Gómez Abajo
 
Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java langer4711
 
Embedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEmbedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEdward Willink
 
Scaffolding with JMock
Scaffolding with JMockScaffolding with JMock
Scaffolding with JMockValerio Maggio
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsNewCircle Training
 
Java 8 - Project Lambda
Java 8 - Project LambdaJava 8 - Project Lambda
Java 8 - Project LambdaRahman USTA
 

What's hot (20)

Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
Java8
Java8Java8
Java8
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In Practice
 
The OCLforUML Profile
The OCLforUML ProfileThe OCLforUML Profile
The OCLforUML Profile
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
 
Lambda Expressions in Java
Lambda Expressions in JavaLambda Expressions in Java
Lambda Expressions in Java
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
 
A DSL for Model Mutation and its Applications to Different Domains
A DSL for Model Mutation and its Applications to Different DomainsA DSL for Model Mutation and its Applications to Different Domains
A DSL for Model Mutation and its Applications to Different Domains
 
Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java Programming with Lambda Expressions in Java
Programming with Lambda Expressions in Java
 
Aligning OCL and UML
Aligning OCL and UMLAligning OCL and UML
Aligning OCL and UML
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Embedded OCL Integration and Debugging
Embedded OCL Integration and DebuggingEmbedded OCL Integration and Debugging
Embedded OCL Integration and Debugging
 
Java 8 Lambda and Streams
Java 8 Lambda and StreamsJava 8 Lambda and Streams
Java 8 Lambda and Streams
 
Scaffolding with JMock
Scaffolding with JMockScaffolding with JMock
Scaffolding with JMock
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
 
Java 8 - Project Lambda
Java 8 - Project LambdaJava 8 - Project Lambda
Java 8 - Project Lambda
 
Roslyn
RoslynRoslyn
Roslyn
 
Scala - core features
Scala - core featuresScala - core features
Scala - core features
 

Similar to TestLang - Annotations for Unit Testing

Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101kankemwa Ishaku
 
SophiaConf 2018 - P. Urso (Activeeon)
SophiaConf 2018 - P. Urso (Activeeon)SophiaConf 2018 - P. Urso (Activeeon)
SophiaConf 2018 - P. Urso (Activeeon)TelecomValley
 
Enrich Your Models With OCL
Enrich Your Models With OCLEnrich Your Models With OCL
Enrich Your Models With OCLEdward Willink
 
Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with javaHawkman Academy
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programmingagorolabs
 
High-performance model queries
High-performance model queriesHigh-performance model queries
High-performance model queriesIstvan Rath
 
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Benoit Combemale
 
EcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleEcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleCédric Brun
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLSteven Feuerstein
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform ResearchVasil Remeniuk
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform researchVasil Remeniuk
 
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...Dimitris Kolovos
 
Distributed Model Validation with Epsilon
Distributed Model Validation with EpsilonDistributed Model Validation with Epsilon
Distributed Model Validation with EpsilonSina Madani
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017Ayush Sharma
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseCoen De Roover
 
Knowledge of Javascript
Knowledge of JavascriptKnowledge of Javascript
Knowledge of JavascriptSamuel Abraham
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Wolfgang Grieskamp
 

Similar to TestLang - Annotations for Unit Testing (20)

Java 101
Java 101Java 101
Java 101
 
Introduction to java 101
Introduction to java 101Introduction to java 101
Introduction to java 101
 
SophiaConf 2018 - P. Urso (Activeeon)
SophiaConf 2018 - P. Urso (Activeeon)SophiaConf 2018 - P. Urso (Activeeon)
SophiaConf 2018 - P. Urso (Activeeon)
 
Enrich Your Models With OCL
Enrich Your Models With OCLEnrich Your Models With OCL
Enrich Your Models With OCL
 
Java 101 intro to programming with java
Java 101  intro to programming with javaJava 101  intro to programming with java
Java 101 intro to programming with java
 
Java 101 Intro to Java Programming
Java 101 Intro to Java ProgrammingJava 101 Intro to Java Programming
Java 101 Intro to Java Programming
 
High-performance model queries
High-performance model queriesHigh-performance model queries
High-performance model queries
 
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
EcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessibleEcoreTools-Next: Executable DSL made (more) accessible
EcoreTools-Next: Executable DSL made (more) accessible
 
utPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQLutPLSQL: Unit Testing for Oracle PL/SQL
utPLSQL: Unit Testing for Oracle PL/SQL
 
Testing in Scala. Adform Research
Testing in Scala. Adform ResearchTesting in Scala. Adform Research
Testing in Scala. Adform Research
 
Testing in Scala by Adform research
Testing in Scala by Adform researchTesting in Scala by Adform research
Testing in Scala by Adform research
 
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...
Developing a new Epsilon Language through Grammar Extension: The Epsilon Dem...
 
Distributed Model Validation with Epsilon
Distributed Model Validation with EpsilonDistributed Model Validation with Epsilon
Distributed Model Validation with Epsilon
 
Angular JS in 2017
Angular JS in 2017Angular JS in 2017
Angular JS in 2017
 
A logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in EclipseA logic foundation for template-based program transformation in Eclipse
A logic foundation for template-based program transformation in Eclipse
 
Eclipse OCL Summary
Eclipse OCL SummaryEclipse OCL Summary
Eclipse OCL Summary
 
Knowledge of Javascript
Knowledge of JavascriptKnowledge of Javascript
Knowledge of Javascript
 
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
Model-Based Testing: Theory and Practice. Keynote @ MoTiP (ISSRE) 2012.
 

More from Antonio García-Domínguez

MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...Antonio García-Domínguez
 
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...Antonio García-Domínguez
 
Boosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackBoosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackAntonio García-Domínguez
 
MODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patternsMODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patternsAntonio García-Domínguez
 
Tips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tablesTips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tablesAntonio García-Domínguez
 
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a serviceCOMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a serviceAntonio García-Domínguez
 
MRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph modelsMRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph modelsAntonio García-Domínguez
 
Hawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQLHawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQLAntonio García-Domínguez
 
OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?Antonio García-Domínguez
 
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...Antonio García-Domínguez
 
Software libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de CádizSoftware libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de CádizAntonio García-Domínguez
 

More from Antonio García-Domínguez (17)

MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
MODELS 2022 Journal-First presentation: ETeMoX - explaining reinforcement lea...
 
MODELS 2022 Picto Web tool demo
MODELS 2022 Picto Web tool demoMODELS 2022 Picto Web tool demo
MODELS 2022 Picto Web tool demo
 
EduSymp 2022 slides (The Epsilon Playground)
EduSymp 2022 slides (The Epsilon Playground)EduSymp 2022 slides (The Epsilon Playground)
EduSymp 2022 slides (The Epsilon Playground)
 
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
History-Aware Explanations: Towards Enabling Human-in-the-Loop in Self-Adapti...
 
Boosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackBoosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedback
 
MODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patternsMODELS 2019: Querying and annotating model histories with time-aware patterns
MODELS 2019: Querying and annotating model histories with time-aware patterns
 
Tips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tablesTips and resources for publication-grade figures and tables
Tips and resources for publication-grade figures and tables
 
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a serviceCOMMitMDE'18: Eclipse Hawk: model repository querying as a service
COMMitMDE'18: Eclipse Hawk: model repository querying as a service
 
MRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph modelsMRT 2018: reflecting on the past and the present with temporal graph models
MRT 2018: reflecting on the past and the present with temporal graph models
 
Hawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQLHawk: indexado de modelos en bases de datos NoSQL
Hawk: indexado de modelos en bases de datos NoSQL
 
Software and product quality for videogames
Software and product quality for videogamesSoftware and product quality for videogames
Software and product quality for videogames
 
OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?OCL'16 slides: Models from Code or Code as a Model?
OCL'16 slides: Models from Code or Code as a Model?
 
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
MoDELS'16 presentation: Integration of a Graph-Based Model Indexer in Commerc...
 
ECMFA 2016 slides
ECMFA 2016 slidesECMFA 2016 slides
ECMFA 2016 slides
 
BMSD 2015 slides (revised)
BMSD 2015 slides (revised)BMSD 2015 slides (revised)
BMSD 2015 slides (revised)
 
Elaboración de un buen póster científico
Elaboración de un buen póster científicoElaboración de un buen póster científico
Elaboración de un buen póster científico
 
Software libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de CádizSoftware libre para la integración de información en la Universidad de Cádiz
Software libre para la integración de información en la Universidad de Cádiz
 

Recently uploaded

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 

Recently uploaded (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 

TestLang - Annotations for Unit Testing

  • 1. MoDELS 2016 Advanced Model Management with EpsilonAdvanced Model Management with EpsilonMoDELS 2016 Developing a new Epsilon Language through Annotations: TestLang Antonio Garcia-Dominguez @antoniogado 1
  • 2. MoDELS 2016 Advanced Model Management with Epsilon When should I use annotations? • One of the Epsilon languages does almost everything that you need, but… • … you need to add a thin layer of orchestration logic on top of it. • Some examples: – Unit testing (EOL + orchestration) – Model generation (EOL + ...) – Model mutation (EOL/ETL + ...) – Categorized model validation (EVL + ...) – Model-driven game engine... 2
  • 3. MoDELS 2016 Advanced Model Management with Epsilon Example TestLang script (v1) var rnd = new Native('java.util.Random'); @test operation allInstancesWorks() { if (Class.all.size != 6) { “FAILED aiw”.println(); } } @test $times 10 * 10 operation randomTest() { var b = 2 + rnd.nextInt(9); var e = rnd.nextInt(10); if (slowPow(b, e) != fastPow(b, e)) { “FAILED rt”.println(); } } 3
  • 4. MoDELS 2016 Advanced Model Management with Epsilon Overview • TestLang is divided into: – org.eclipse.epsilon.examples.testlang.engine implements the language (Eclipse-agnostic) – org.eclipse.epsilon.examples.testlang.dt provides Eclipse dev tools • Sources here: – https://git.eclipse.org/c/epsilon/org.eclipse.e psilon.git/tree/examples 4
  • 5. MoDELS 2016 Advanced Model Management with Epsilon TESTLANG EXECUTION ENGINE Implementing a simple unit testing language on top of EOL 5
  • 6. MoDELS 2016 Advanced Model Management with Epsilon TestLangModule: execution engine ● Inherits from EolModule, overrides methods ○ execute(): interprets @test and $times ● 68 lines of Java code 6
  • 7. MoDELS 2016 Advanced Model Management with Epsilon AnnotatableModuleElement • Superclass of anything that can be annotated – EOL operations – ETL rules – EVL contexts and constraints... • Two types of annotations supported: – Simple: “@test a” - constant value – Executable: “$test self.x * 2” - uses expression – Repeated annotations are allowed • Provides methods for handling annotations 7
  • 8. MoDELS 2016 Advanced Model Management with Epsilon Example TestLang script (v2) var rnd = new Native('java.util.Random'); @test operation allInstancesWorks() { areEqual(6, Class.all.size); } @test $times 10 * 10 operation randomTest() { var base = 2 + rnd.nextInt(9); var exp = rnd.nextInt(10); areEqual(slowPow(base, exp), fastPow(base, exp)); } 8
  • 9. MoDELS 2016 Advanced Model Management with Epsilon TestLangModule: add areEqual ● By overriding prepareContext(), we can add task-specific operations/variables ● Operations provided by OperationContributor 9
  • 10. MoDELS 2016 Advanced Model Management with Epsilon Operation contributors • When processing x.f(args): – contributesTo(x) must return true – f(args) must be a method of the contributor • Contextless operations (e.g. “areEqual”) receive a special value in contributesTo: – EolNoType.NoInstance 10
  • 11. MoDELS 2016 Advanced Model Management with Epsilon TESTLANG ECLIPSE-BASED DEVELOPER TOOLS Integration of TestLang into Eclipse 11
  • 12. MoDELS 2016 Advanced Model Management with Epsilon 12
  • 13. MoDELS 2016 Advanced Model Management with Epsilon TestLang developer tools • Same approach as the engine: inherit from common.dt / eol.dt and refine as desired – 65 lines of Java code • plugin.xml (49 lines): – Integrates all our subclasses – Associates .eolt with the “New TestLang” wizard – Reuses EOL editor/debugger for .eolt files – Provides a custom icon for .eolt launch configs • In short: mostly plumbing! 13
  • 14. MoDELS 2016 Advanced Model Management with Epsilon TestLang editor: same as EOL 14
  • 15. MoDELS 2016 Advanced Model Management with Epsilon TestLang launch facilities 15
  • 16. MoDELS 2016 Advanced Model Management with Epsilon Summary • Showed how to implement a unit testing language on top of EOL: – @test tags an operation as a test case – $times allows for repeating the same test • Reuses all EOL tooling: – Editor and debugger “for free” – Can work with EMF, CSV, BibTeX, XML, ... • < 200 lines of code: 133 Java, 49 XML 16
  • 17. MoDELS 2016 Advanced Model Management with EpsilonAdvanced Model Management with EpsilonMoDELS 2016 Questions? @antoniogado 17
  • 18. MoDELS 2016 Advanced Model Management with Epsilon Other examples @operator $condition self.isKindOf(Addition) operation add2sub() { // … return Subtraction } @operator $condition self.isKindOf(BooleanLiteral) operation flipLiteral() { // … return negated BooleanLiteral } For a model mutation language: 18
  • 19. MoDELS 2016 Advanced Model Management with Epsilon Other examples @enemy @after blinky @sprite red_ghost.png operation inky(player, enemies) { // … compute which way to turn next … // … compute speed … } In a model-driven game engine, operations could provide behavior for AI actors: The language can provide built-in operations for common/expensive tasks (e.g. pathfinding algorithms). 19