SlideShare a Scribd company logo
1 of 23
Download to read offline
1
1
1
Evref
fervE
A Unit Test Metamodel
for Test Generation
Gabriel Darbord¹
Anne Etien¹
Nicolas Anquetil¹
Benoit Verhaeghe²
Mustapha Derras²
¹Univ. Lille, CNRS, Inria, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
²Berger-Levrault, France
IWST 2023
Evref
fervE
2
2
2
Evref
fervE
The Importance of Testing
§ Nowadays, when developping new software systems:
§ 20-50% time spent on testing
§ We test because we want:
§ Bug detection and prevention
§ Quality assurance
§ User satisfaction
§ Non-regression
§ Confidence
§ Etc.
3
3
3
Evref
fervE
Legacy Software System Lack Tests
§ In 2022, Berger-Levrault owns 150 software programs
§ Three-tier architectures (client, server, database)
§ Millions of lines of code
§ Different legacy technologies that can be up to 25 years old
§ Severe lack of tests
§ Developers fear changes
4
4
4
Evref
fervE
Towards Automated Test Generation
§ Berger-Levrault wants tests for their legacy software
§ Impossible to write them manually
§ Time consuming
§ Difficult and error-prone
§ Lack of resources
5
5
5
Evref
fervE
Our Test Generation Approach
§ Using software models and execution traces
§ static and dynamic analysis
§ Our objective is to generate tests that are:
§ Relevant
§ Readable
§ Maintainable
§ Not relying on existing tests
6
6
6
Evref
fervE
Different Criteria
Paper Relevant Readable Maintainable
J. Pires et al. ~ ~ +
G. Fraser et al. ~ - ~
A. C. R. Paiva et al. + ~ ~
M. Tufano et al. ~ + ~
LLM approaches need to be trained on codebase and existing tests
7
7
7
Evref
fervE
About the Moose Platform
§ Moose is a platform for software analysis
§ It allows to:
§ Represent a software system in a model
§ Query, manipulate, transform, and visualize models
8
8
8
Evref
fervE
An Approach Based on Metamodels
Codebase Traces
Value
Model
Code
Model
Unit Test
Model
Unit Test
M0
Reality
M1
Models
M2
Metamodels
Value
Metamodel
Code
Metamodel
Unit Test
Metamodel
analyze extract generate
build
conformsTo conformsTo conformsTo
produce
9
9
9
Evref
fervE
Unit Test Metamodel
TestSuite TestCase TestMethod
Fixture
SetUp
TearDown Assertion
before
beforeAll
beforeEach
cleanups
arrangements
*
Value
*
* *
*
*
expected
arguments
valuesToHandle
Class Method
*
testedClass testedMethod
* unitTests
Act
after
afterAll
afterEach
* *
*
10
10
10
Evref
fervE
Value Metamodel
Value
Dictionary Primitive
Collection Object
EnumValue
Unknown
Association
dictionaryValue
dictionaryKey
* *
*
*
attributes
*
references
*
*
*
*
capturedValues
UnknownType
Type
TypedEntity
EnumValue
*
elements
source
11
11
11
Evref
fervE
Example Value Model
[{"name": "John Doe"}]
Set<User> getUsers()
Produces trace Modelized
Code
Value
"John Doe"
:Primitive
:Collection
:Object
HashSet<User>
:Type
getUsers()
:TypedEntity
User :Type
String :Type
name
source
type
type
type
12
12
12
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
13
13
13
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
14
14
14
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
15
15
15
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
16
16
16
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
17
17
17
Evref
fervE
Build Unit Test Using Model Transformations
Code
Model
Method
Parameter
Class
Unit Test
Model
TestCase
TestMethod
Arrange
Act
Assert
Value
Model
Argument
Result
18
18
18
Evref
fervE
Export Code Using Abstract Syntax Trees
M0
Reality
M1
Models
M2
Metamodels
Unit Test
Model
Unit Test
Metamodel
conformsTo
AST
Metamodel
AST
Model
Unit Test
conformsTo
export refactor
generate
19
19
19
Evref
fervE
Refactoring Abstract Syntax Trees
Statements
VarDecl
Variable
name
Primitive
"John Doe"
MethodCall
setName
Variable
user
Variable
name
String name = "John Doe";
user.setName(name);
20
20
20
Evref
fervE
Refactoring Abstract Syntax Trees
Statements
VarDecl
Variable
name
Primitive
"John Doe"
MethodCall
setName
Variable
user
Variable
name
Statements
Primitive
"John Doe"
MethodCall
setName
Variable
user
Inline constants
String name = "John Doe";
user.setName(name);
user.setName("John Doe");
21
21
21
Evref
fervE
Example of Generated Test for JUnit
class UserManager {
Set<User> users;
Set<User> usersByName(String name) {
Set<User> result = new HashSet<>();
for (User user: users)
if (user.getName().equals(name))
result.add(user);
return result;
}
}
class UserManagerTest {
UserManager manager = new UserManager();
@Test void testUsersByName() {
Set<User> expected = new HashSet<>();
User user = new User();
user.setName("John Doe");
expected.add(user);
Set<User> actual = manager
.usersByName("John Doe");
assertEquals(expected, actual);
}
}
Application code Generated test code
22
22
22
Evref
fervE
Future Work
§ Pursue test quality
§ Relevant, readable, maintainable…
§ Evaluate our approach in Pharo, thanks to our community
§ Compare existing tests to generated tests
§ Generate unit tests for our industrial partner Berger-Levrault
UT
23
23
23
Evref
fervE
8
8
8
Evref
fervE
An Approach Based on Metamodels
Codebase Traces
Value
Model
Code
Model
Unit Test
Model
Unit Test
M0
Reality
M1
Models
M2
Metamodels
Value
Metamodel
Code
Metamodel
Unit Test
Metamodel
analyze extract generate
build
conformsTo conformsTo conformsTo
produce
21
21
21
Evref
fervE
Example of Generated Test for JUnit
class UserManager {
Set<User> users;
Set<User> usersByName(String name) {
Set<User> result = new HashSet<>();
for (User user: users)
if (user.getName().equals(name))
result.add(user);
return result;
}
}
class UserManagerTest {
UserManager manager = new UserManager();
@Test void testUsersByName() {
Set<User> expected = new HashSet<>();
User user = new User();
user.setName("John Doe");
expected.add(user);
Set<User> actual = manager
.usersByName("John Doe");
assertEquals(expected, actual);
}
}
Application code Generated test code
5
5
5
Evref
fervE
Our Test Generation Approach
§ Using software models and execution traces
§ static and dynamic analysis
§ Our objective is to generate tests that are:
§ Relevant
§ Readable
§ Maintainable
§ Not relying on existing tests
9
9
9
Evref
fervE
Unit Test Metamodel
TestSuite TestCase TestMethod
Fixture
SetUp
TearDown Assertion
before
beforeAll
beforeEach
cleanups
arrangements
*
Value
*
* *
*
*
expected
arguments
valuesToHandle
Class Method
*
testedClass testedMethod
* unitTests
Act
after
afterAll
afterEach
* *
*
Conclusion

More Related Content

Similar to A Unit Test Metamodel for Test Generation

Software Testing Tools Training
Software Testing Tools TrainingSoftware Testing Tools Training
Software Testing Tools TrainingQEdge Tech
 
Software testing: an introduction - 2015
Software testing: an introduction - 2015Software testing: an introduction - 2015
Software testing: an introduction - 2015XavierDevroey
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...GeeksLab Odessa
 
GPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesGPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesMohamed BOUSSAA
 
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...IncQuery Labs
 
Search-Based Robustness Testing of Data Processing Systems
Search-Based Robustness Testing of Data Processing SystemsSearch-Based Robustness Testing of Data Processing Systems
Search-Based Robustness Testing of Data Processing SystemsLionel Briand
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Codeerikmsp
 
Continuous Delivery with a PaaS Application
Continuous Delivery with a PaaS ApplicationContinuous Delivery with a PaaS Application
Continuous Delivery with a PaaS ApplicationMark Rendell
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022Mark Niebergall
 
Verify Your Kubernetes Clusters with Upstream e2e tests
Verify Your Kubernetes Clusters with Upstream e2e testsVerify Your Kubernetes Clusters with Upstream e2e tests
Verify Your Kubernetes Clusters with Upstream e2e testsKen'ichi Ohmichi
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...Iosif Itkin
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Mark Niebergall
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
Leveraging Existing Tests in Automated Test Generation for Web Applications
Leveraging Existing Tests in Automated Test Generation for Web ApplicationsLeveraging Existing Tests in Automated Test Generation for Web Applications
Leveraging Existing Tests in Automated Test Generation for Web ApplicationsSALT Lab @ UBC
 
Continuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsContinuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsMark Rendell
 
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePoint
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePointSPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePoint
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePointNCCOMMS
 
Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)Kevin Schultz
 
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't Suck
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't SuckDeliver Faster with BDD/TDD - Designing Automated Tests That Don't Suck
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't SuckKevin Brockhoff
 
Testing: Do More With Less
Testing: Do More With LessTesting: Do More With Less
Testing: Do More With LessEugene Fidelin
 

Similar to A Unit Test Metamodel for Test Generation (20)

Software Testing Tools Training
Software Testing Tools TrainingSoftware Testing Tools Training
Software Testing Tools Training
 
Software testing: an introduction - 2015
Software testing: an introduction - 2015Software testing: an introduction - 2015
Software testing: an introduction - 2015
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
 
GPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators FamiliesGPCE16: Automatic Non-functional Testing of Code Generators Families
GPCE16: Automatic Non-functional Testing of Code Generators Families
 
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...
Towards Scalable Validation of Low-Code System Models: Mapping EVL to VIATRA ...
 
Search-Based Robustness Testing of Data Processing Systems
Search-Based Robustness Testing of Data Processing SystemsSearch-Based Robustness Testing of Data Processing Systems
Search-Based Robustness Testing of Data Processing Systems
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
 
Continuous Delivery with a PaaS Application
Continuous Delivery with a PaaS ApplicationContinuous Delivery with a PaaS Application
Continuous Delivery with a PaaS Application
 
Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022Leveling Up With Unit Testing - LonghornPHP 2022
Leveling Up With Unit Testing - LonghornPHP 2022
 
Verify Your Kubernetes Clusters with Upstream e2e tests
Verify Your Kubernetes Clusters with Upstream e2e testsVerify Your Kubernetes Clusters with Upstream e2e tests
Verify Your Kubernetes Clusters with Upstream e2e tests
 
FV04_MostoviczT_RAD
FV04_MostoviczT_RADFV04_MostoviczT_RAD
FV04_MostoviczT_RAD
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
 
Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023Leveling Up With Unit Testing - php[tek] 2023
Leveling Up With Unit Testing - php[tek] 2023
 
Unit testing
Unit testing Unit testing
Unit testing
 
Leveraging Existing Tests in Automated Test Generation for Web Applications
Leveraging Existing Tests in Automated Test Generation for Web ApplicationsLeveraging Existing Tests in Automated Test Generation for Web Applications
Leveraging Existing Tests in Automated Test Generation for Web Applications
 
Continuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations TeamsContinuous Delivery for IT Operations Teams
Continuous Delivery for IT Operations Teams
 
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePoint
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePointSPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePoint
SPCA2013 - Taking advantage of Visual Studio to develop Apps for SharePoint
 
Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)Building Maintainable Android Apps (DroidCon NYC 2014)
Building Maintainable Android Apps (DroidCon NYC 2014)
 
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't Suck
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't SuckDeliver Faster with BDD/TDD - Designing Automated Tests That Don't Suck
Deliver Faster with BDD/TDD - Designing Automated Tests That Don't Suck
 
Testing: Do More With Less
Testing: Do More With LessTesting: Do More With Less
Testing: Do More With Less
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 
BioSmalltalk
BioSmalltalkBioSmalltalk
BioSmalltalkESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 
BioSmalltalk
BioSmalltalkBioSmalltalk
BioSmalltalk
 

Recently uploaded

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
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
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
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
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
(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
 
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.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
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
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
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
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
(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...
 
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...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 

A Unit Test Metamodel for Test Generation

  • 1. 1 1 1 Evref fervE A Unit Test Metamodel for Test Generation Gabriel Darbord¹ Anne Etien¹ Nicolas Anquetil¹ Benoit Verhaeghe² Mustapha Derras² ¹Univ. Lille, CNRS, Inria, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France ²Berger-Levrault, France IWST 2023 Evref fervE
  • 2. 2 2 2 Evref fervE The Importance of Testing § Nowadays, when developping new software systems: § 20-50% time spent on testing § We test because we want: § Bug detection and prevention § Quality assurance § User satisfaction § Non-regression § Confidence § Etc.
  • 3. 3 3 3 Evref fervE Legacy Software System Lack Tests § In 2022, Berger-Levrault owns 150 software programs § Three-tier architectures (client, server, database) § Millions of lines of code § Different legacy technologies that can be up to 25 years old § Severe lack of tests § Developers fear changes
  • 4. 4 4 4 Evref fervE Towards Automated Test Generation § Berger-Levrault wants tests for their legacy software § Impossible to write them manually § Time consuming § Difficult and error-prone § Lack of resources
  • 5. 5 5 5 Evref fervE Our Test Generation Approach § Using software models and execution traces § static and dynamic analysis § Our objective is to generate tests that are: § Relevant § Readable § Maintainable § Not relying on existing tests
  • 6. 6 6 6 Evref fervE Different Criteria Paper Relevant Readable Maintainable J. Pires et al. ~ ~ + G. Fraser et al. ~ - ~ A. C. R. Paiva et al. + ~ ~ M. Tufano et al. ~ + ~ LLM approaches need to be trained on codebase and existing tests
  • 7. 7 7 7 Evref fervE About the Moose Platform § Moose is a platform for software analysis § It allows to: § Represent a software system in a model § Query, manipulate, transform, and visualize models
  • 8. 8 8 8 Evref fervE An Approach Based on Metamodels Codebase Traces Value Model Code Model Unit Test Model Unit Test M0 Reality M1 Models M2 Metamodels Value Metamodel Code Metamodel Unit Test Metamodel analyze extract generate build conformsTo conformsTo conformsTo produce
  • 9. 9 9 9 Evref fervE Unit Test Metamodel TestSuite TestCase TestMethod Fixture SetUp TearDown Assertion before beforeAll beforeEach cleanups arrangements * Value * * * * * expected arguments valuesToHandle Class Method * testedClass testedMethod * unitTests Act after afterAll afterEach * * *
  • 10. 10 10 10 Evref fervE Value Metamodel Value Dictionary Primitive Collection Object EnumValue Unknown Association dictionaryValue dictionaryKey * * * * attributes * references * * * * capturedValues UnknownType Type TypedEntity EnumValue * elements source
  • 11. 11 11 11 Evref fervE Example Value Model [{"name": "John Doe"}] Set<User> getUsers() Produces trace Modelized Code Value "John Doe" :Primitive :Collection :Object HashSet<User> :Type getUsers() :TypedEntity User :Type String :Type name source type type type
  • 12. 12 12 12 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 13. 13 13 13 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 14. 14 14 14 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 15. 15 15 15 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 16. 16 16 16 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 17. 17 17 17 Evref fervE Build Unit Test Using Model Transformations Code Model Method Parameter Class Unit Test Model TestCase TestMethod Arrange Act Assert Value Model Argument Result
  • 18. 18 18 18 Evref fervE Export Code Using Abstract Syntax Trees M0 Reality M1 Models M2 Metamodels Unit Test Model Unit Test Metamodel conformsTo AST Metamodel AST Model Unit Test conformsTo export refactor generate
  • 19. 19 19 19 Evref fervE Refactoring Abstract Syntax Trees Statements VarDecl Variable name Primitive "John Doe" MethodCall setName Variable user Variable name String name = "John Doe"; user.setName(name);
  • 20. 20 20 20 Evref fervE Refactoring Abstract Syntax Trees Statements VarDecl Variable name Primitive "John Doe" MethodCall setName Variable user Variable name Statements Primitive "John Doe" MethodCall setName Variable user Inline constants String name = "John Doe"; user.setName(name); user.setName("John Doe");
  • 21. 21 21 21 Evref fervE Example of Generated Test for JUnit class UserManager { Set<User> users; Set<User> usersByName(String name) { Set<User> result = new HashSet<>(); for (User user: users) if (user.getName().equals(name)) result.add(user); return result; } } class UserManagerTest { UserManager manager = new UserManager(); @Test void testUsersByName() { Set<User> expected = new HashSet<>(); User user = new User(); user.setName("John Doe"); expected.add(user); Set<User> actual = manager .usersByName("John Doe"); assertEquals(expected, actual); } } Application code Generated test code
  • 22. 22 22 22 Evref fervE Future Work § Pursue test quality § Relevant, readable, maintainable… § Evaluate our approach in Pharo, thanks to our community § Compare existing tests to generated tests § Generate unit tests for our industrial partner Berger-Levrault UT
  • 23. 23 23 23 Evref fervE 8 8 8 Evref fervE An Approach Based on Metamodels Codebase Traces Value Model Code Model Unit Test Model Unit Test M0 Reality M1 Models M2 Metamodels Value Metamodel Code Metamodel Unit Test Metamodel analyze extract generate build conformsTo conformsTo conformsTo produce 21 21 21 Evref fervE Example of Generated Test for JUnit class UserManager { Set<User> users; Set<User> usersByName(String name) { Set<User> result = new HashSet<>(); for (User user: users) if (user.getName().equals(name)) result.add(user); return result; } } class UserManagerTest { UserManager manager = new UserManager(); @Test void testUsersByName() { Set<User> expected = new HashSet<>(); User user = new User(); user.setName("John Doe"); expected.add(user); Set<User> actual = manager .usersByName("John Doe"); assertEquals(expected, actual); } } Application code Generated test code 5 5 5 Evref fervE Our Test Generation Approach § Using software models and execution traces § static and dynamic analysis § Our objective is to generate tests that are: § Relevant § Readable § Maintainable § Not relying on existing tests 9 9 9 Evref fervE Unit Test Metamodel TestSuite TestCase TestMethod Fixture SetUp TearDown Assertion before beforeAll beforeEach cleanups arrangements * Value * * * * * expected arguments valuesToHandle Class Method * testedClass testedMethod * unitTests Act after afterAll afterEach * * * Conclusion