SlideShare a Scribd company logo
An Exploratory Study on the Refactoring of
Unit Test Files in Android Applications
Anthony Peruma, Christian D. Newman, Mohamed Wiem Mkaouer, Ali Ouni, Fabio Palomba
4 t h I n t e r n a t i o n a l W o r k s h o p o n R e f a c t o r i n g ( I W o R 2 0 2 0 )
REFACTORING
Smelly source
code files
Refactoring
source code
Smell free
source code
Smells are symptoms of bad
programming practices – a
threat to design
Refactoring improves the
internal design of software
systems without altering its
external behavior
Refactoring involves locating
and correcting smells
exhibited by the source code
An essential software maintenance activity
Refactoring operations enable developers to take necessary actions to correct bad programming practices
01
TEST SMELLS
Test code, like production code, is subject to smells
Formally introduced in 2001 with 11 smell types
Inclusion of additional smell types, analysis of their
evolution and longevity, and elimination patterns
Tools to detect specific smell types
Studies on traditional Java applications
02
2.5 million+ apps
available on
Google Play
(December 2019)
03
GOAL
Expand our understanding of the
relationship between refactoring
changes and their effect on test smells
in Android apps
04
RESEARCH QUESTIONS
What types of refactoring operations are applied to
unit test files compared to non-test files?01
What types of refactoring operations are frequently
applied to smelly test files?02
What kinds of refactorings are typically used to remove
test smells?03
05
CONTRIBUTIONS
01
An understanding of
refactoring operations
applied to test suites of
Android apps
02
Insights into the
relationships between
refactoring operations
and test smells
03
A dataset for replication
and extension
purposes, available on
our project website
06
EXPERIMENT DESIGN
Dataset of test
files & smells in
Android apps
Detection of
refactoring
operations
Dataset of
refactoring
operations
Analysis of results
open-source apps: 250 refactored test files: 4,709
refactoring commits: 62,953
refactoring operations: 336,771
07
TEST SMELLS & REFACTORING OPERATIONS
◸ Assertion Roulette
◸ Conditional Test Logic
◸ Constructor Initialization
◸ Default Test
◸ Duplicate Assert
◸ Eager Test
◸ Empty Test
◸ Exception Handling
◸ General Fixture
◸ Ignored Test
.
.
.
◸ Rename Method
◸ Change Variable Type
◸ Rename Variable
◸ Inline Method
◸ Extract Method
◸ Move Class
◸ Move Method
◸ Pull Up Method
◸ Split Attribute
◸ Push Down Method.
.
.
.
19 Test Smells 39 Refactoring Operations
08
RQ 1 - What types of refactoring operations are applied
to unit test files compared to non-test files?
◸ 91.98% of refactorings are applied to methods
Vs. 8.02% to classes
Refactoring Operations Count %
Rename Method 1511 19.81%
Change Variable Type 1452 19.03%
Rename Variable 803 10.53%
Change Attribute Type 773 10.13%
Extract Method 426 5.58%
Other Operations 2,664 34.29%
Total 7,629 100%
Refactoring Operations Count %
Move Class 23,180 13.33%
Change Parameter Type 14,178 8.15%
Change Attribute Type 12,921 7.43%
Rename Method 12,074 6.94%
Rename Parameter 11,299 6.50%
Other Operations 100,249 57.65%
Total 173,901 100%
Test Files Non-Test Files
◸ 49.27% of refactorings are applied to methods
Vs. 50.73% to classes
65% 42%
◸ Test files tend to undergo more renames ◸ Non-test files are subject to more design level
types of refactorings 09
RQ 2 - What types of refactoring operations are
frequently applied to smelly test files?
Co-occurring
Count %Smell Type Refactoring Operation
Assertion Roulette Change Variable Type 141 53.01%
Eager Test Extract Method 14 42.42%
Lazy Test Extract Method 20 30.30%
General Fixture Change Attribute Type 8 38.10%
Redundant
Assertion Move Method 9 29.03%
Approach: Extracted test files that exhibited only one smell type and then looked at the refactorings in the file
4,589 test files that had one or more smells had undergone a refactoring
The attribute is utilized in the setup()
method
The variable and the smell exist
within a test method
These smells and refactoring
operation are related to test methods
A debugging smell introduced when
making design level changes
10
RQ 3 - What kinds of refactorings are typically used to
remove test smells?
Approach: Lifetime history of a smelly test file; matched the refactoring applied with a smell reduction
38%2.121.30
Avg. smells removed
by refactoring test file
Avg. refactoring operations
to reduce smell count
Freq. for a single refactoring
to remove a single smell type
481
Smelly test files that had
a reduction & refactoring
◸ Change Variable Type being one of the most common refactorings applied when a smell is removed
◸ Eager Test is frequently resolved by developers when performing a single refactoring operation
◸ Please refer the paper for a qualitative based set of examples on the co-occurrence of smell type
reduction and refactoring operations -- Extract Method resolving the Conditional Test Logic smell
◸ Manual review - most refactorings are applied for reasons other than for the correction of smell
◹ More in-depth, and developer supported, studies are needed
11
TAKEAWAYS
RQ 1
Developers are better
prepared to estimate
rework effort for (non-)
test files
Specialized tools for
refactoring files
RQ 2
Developers are better
prepared in determining
the most likely smell
being introduced when
performing a refactoring
of a test file
RQ 3
Refactoring of test files
are mostly related to
development activities
such as fixing issues,
adhering to coding
standards, etc.
12
SUMMARY
Mined refactoring operations and test smells in 250
open-source Android apps01
App developers apply a different set of refactorings to
test and non-test source code files02
There exist scenarios where refactoring operations are
utilized to correct a test smell04
Certain test smells and refactoring operations that co-
occur frequently (e.g., Lazy Test & Extract Method)03
13
THANKS!
h t t p s : / / t e s t s m e l l s . g i t h u b . i o
An Exploratory Study on the Refactoring of Unit Test Files in Android Applications

More Related Content

Similar to An Exploratory Study on the Refactoring of Unit Test Files in Android Applications

A Mono- and Multi-objective Approach for Recommending Software Refactoring
A Mono- and Multi-objective Approach for Recommending Software RefactoringA Mono- and Multi-objective Approach for Recommending Software Refactoring
A Mono- and Multi-objective Approach for Recommending Software Refactoring
Ali Ouni
 
Code Smell, Software Engineering
Code Smell, Software EngineeringCode Smell, Software Engineering
Code Smell, Software Engineering
Anshul Vinayak
 
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
acijjournal
 
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
acijjournal
 
Track g semiconductor test program - testinsight
Track g  semiconductor test program - testinsightTrack g  semiconductor test program - testinsight
Track g semiconductor test program - testinsightchiportal
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code Quality
Delft University of Technology
 
Recommending Software Refactoring Using Search-based Software Enginnering
Recommending Software Refactoring Using Search-based Software EnginneringRecommending Software Refactoring Using Search-based Software Enginnering
Recommending Software Refactoring Using Search-based Software Enginnering
Ali Ouni
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
eSAT Journals
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
eSAT Publishing House
 
Phenolics assays - Tannins
Phenolics assays - TanninsPhenolics assays - Tannins
Phenolics assays - Tannins
Thành Lý Phạm
 
Agile maintenance
Agile maintenanceAgile maintenance
Agile maintenancearalikatte
 
Software testing services in India .pptx
Software testing services in India .pptxSoftware testing services in India .pptx
Software testing services in India .pptx
SakshiPatel82
 
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONSQUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
ijseajournal
 
Software Refactoring Under Uncertainty: A Robust Multi-Objective Approach
Software Refactoring Under Uncertainty:  A Robust Multi-Objective ApproachSoftware Refactoring Under Uncertainty:  A Robust Multi-Objective Approach
Software Refactoring Under Uncertainty: A Robust Multi-Objective Approach
Wiem Mkaouer
 
Software Reuse: Challenges and Business Success
Software Reuse: Challenges and Business SuccessSoftware Reuse: Challenges and Business Success
Software Reuse: Challenges and Business Success
University of Zurich
 
C41041120
C41041120C41041120
C41041120
IJERA Editor
 
Software maintenance
Software maintenanceSoftware maintenance
Software maintenance
Ansh Kapoor
 
Solving the 3 Biggest Questions in Continuous Testing
Solving the 3 Biggest Questions in Continuous TestingSolving the 3 Biggest Questions in Continuous Testing
Solving the 3 Biggest Questions in Continuous Testing
Perfecto by Perforce
 

Similar to An Exploratory Study on the Refactoring of Unit Test Files in Android Applications (20)

A Mono- and Multi-objective Approach for Recommending Software Refactoring
A Mono- and Multi-objective Approach for Recommending Software RefactoringA Mono- and Multi-objective Approach for Recommending Software Refactoring
A Mono- and Multi-objective Approach for Recommending Software Refactoring
 
Code Smell, Software Engineering
Code Smell, Software EngineeringCode Smell, Software Engineering
Code Smell, Software Engineering
 
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
A Model To Compare The Degree Of Refactoring Opportunities Of Three Projects ...
 
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
A MODEL TO COMPARE THE DEGREE OF REFACTORING OPPORTUNITIES OF THREE PROJECTS ...
 
Track g semiconductor test program - testinsight
Track g  semiconductor test program - testinsightTrack g  semiconductor test program - testinsight
Track g semiconductor test program - testinsight
 
On The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code QualityOn The Relation of Test Smells to Software Code Quality
On The Relation of Test Smells to Software Code Quality
 
Recommending Software Refactoring Using Search-based Software Enginnering
Recommending Software Refactoring Using Search-based Software EnginneringRecommending Software Refactoring Using Search-based Software Enginnering
Recommending Software Refactoring Using Search-based Software Enginnering
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
 
Multi step automated refactoring for code smell
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
 
Phenolics assays - Tannins
Phenolics assays - TanninsPhenolics assays - Tannins
Phenolics assays - Tannins
 
Agile maintenance
Agile maintenanceAgile maintenance
Agile maintenance
 
Software testing services in India .pptx
Software testing services in India .pptxSoftware testing services in India .pptx
Software testing services in India .pptx
 
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONSQUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
QUALITY METRICS OF TEST SUITES IN TESTDRIVEN DESIGNED APPLICATIONS
 
Software Refactoring Under Uncertainty: A Robust Multi-Objective Approach
Software Refactoring Under Uncertainty:  A Robust Multi-Objective ApproachSoftware Refactoring Under Uncertainty:  A Robust Multi-Objective Approach
Software Refactoring Under Uncertainty: A Robust Multi-Objective Approach
 
Software Reuse: Challenges and Business Success
Software Reuse: Challenges and Business SuccessSoftware Reuse: Challenges and Business Success
Software Reuse: Challenges and Business Success
 
C41041120
C41041120C41041120
C41041120
 
Smoke testing
Smoke testingSmoke testing
Smoke testing
 
Software maintenance
Software maintenanceSoftware maintenance
Software maintenance
 
Solving the 3 Biggest Questions in Continuous Testing
Solving the 3 Biggest Questions in Continuous TestingSolving the 3 Biggest Questions in Continuous Testing
Solving the 3 Biggest Questions in Continuous Testing
 
Regression testing
Regression testingRegression testing
Regression testing
 

More from University of Hawai‘i at Mānoa

Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
University of Hawai‘i at Mānoa
 
A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]
University of Hawai‘i at Mānoa
 
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
University of Hawai‘i at Mānoa
 
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
University of Hawai‘i at Mānoa
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
University of Hawai‘i at Mānoa
 
A Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier NamingA Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier Naming
University of Hawai‘i at Mānoa
 
Test Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to DetectionTest Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to Detection
University of Hawai‘i at Mānoa
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
University of Hawai‘i at Mānoa
 
Understanding Digits in Identifier Names: An Exploratory Study
Understanding Digits in Identifier Names: An Exploratory StudyUnderstanding Digits in Identifier Names: An Exploratory Study
Understanding Digits in Identifier Names: An Exploratory Study
University of Hawai‘i at Mānoa
 
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
University of Hawai‘i at Mānoa
 
IDEAL: An Open-Source Identifier Name Appraisal Tool
IDEAL: An Open-Source Identifier Name Appraisal ToolIDEAL: An Open-Source Identifier Name Appraisal Tool
IDEAL: An Open-Source Identifier Name Appraisal Tool
University of Hawai‘i at Mānoa
 
Using Grammar Patterns to Interpret Test Method Name Evolution
Using Grammar Patterns to Interpret Test Method Name EvolutionUsing Grammar Patterns to Interpret Test Method Name Evolution
Using Grammar Patterns to Interpret Test Method Name Evolution
University of Hawai‘i at Mānoa
 
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
University of Hawai‘i at Mānoa
 
Contextualizing Rename Decisions using Refactorings and Commit Messages
Contextualizing Rename Decisions using Refactorings and Commit MessagesContextualizing Rename Decisions using Refactorings and Commit Messages
Contextualizing Rename Decisions using Refactorings and Commit Messages
University of Hawai‘i at Mānoa
 
On the Distribution of Test Smells in Open Source Android Applications: An Ex...
On the Distribution of Test Smells in Open Source Android Applications: An Ex...On the Distribution of Test Smells in Open Source Android Applications: An Ex...
On the Distribution of Test Smells in Open Source Android Applications: An Ex...
University of Hawai‘i at Mānoa
 
A Preliminary Study of Android Refactorings
A Preliminary Study of Android RefactoringsA Preliminary Study of Android Refactorings
A Preliminary Study of Android Refactorings
University of Hawai‘i at Mānoa
 
Permission Issues in Open-Source Android Apps: An Exploratory Study
Permission Issues in Open-Source Android Apps: An Exploratory StudyPermission Issues in Open-Source Android Apps: An Exploratory Study
Permission Issues in Open-Source Android Apps: An Exploratory Study
University of Hawai‘i at Mānoa
 
A Career In IT
A Career In ITA Career In IT
Web Content Management - Introduction
Web Content Management - IntroductionWeb Content Management - Introduction
Web Content Management - Introduction
University of Hawai‘i at Mānoa
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
University of Hawai‘i at Mānoa
 

More from University of Hawai‘i at Mānoa (20)

Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
Rename Chains: An Exploratory Study on the Occurrence and Characteristics of ...
 
A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]A Primer on High-Quality Identifier Naming [ASE 2022]
A Primer on High-Quality Identifier Naming [ASE 2022]
 
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
Supporting the Maintenance of Identifier Names: A Holistic Approach to High-Q...
 
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...Preparing for the  Academic Job Market:  Experience and Tips from  a Recent F...
Preparing for the Academic Job Market: Experience and Tips from a Recent F...
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
 
A Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier NamingA Primer on High-Quality Identifier Naming
A Primer on High-Quality Identifier Naming
 
Test Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to DetectionTest Anti-Patterns: From Definition to Detection
Test Anti-Patterns: From Definition to Detection
 
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
Refactoring Debt: Myth or Reality? An Exploratory Study on the Relationship B...
 
Understanding Digits in Identifier Names: An Exploratory Study
Understanding Digits in Identifier Names: An Exploratory StudyUnderstanding Digits in Identifier Names: An Exploratory Study
Understanding Digits in Identifier Names: An Exploratory Study
 
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
How Do I Refactor This? An Empirical Study on Refactoring Trends and Topics i...
 
IDEAL: An Open-Source Identifier Name Appraisal Tool
IDEAL: An Open-Source Identifier Name Appraisal ToolIDEAL: An Open-Source Identifier Name Appraisal Tool
IDEAL: An Open-Source Identifier Name Appraisal Tool
 
Using Grammar Patterns to Interpret Test Method Name Evolution
Using Grammar Patterns to Interpret Test Method Name EvolutionUsing Grammar Patterns to Interpret Test Method Name Evolution
Using Grammar Patterns to Interpret Test Method Name Evolution
 
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Explorator...
 
Contextualizing Rename Decisions using Refactorings and Commit Messages
Contextualizing Rename Decisions using Refactorings and Commit MessagesContextualizing Rename Decisions using Refactorings and Commit Messages
Contextualizing Rename Decisions using Refactorings and Commit Messages
 
On the Distribution of Test Smells in Open Source Android Applications: An Ex...
On the Distribution of Test Smells in Open Source Android Applications: An Ex...On the Distribution of Test Smells in Open Source Android Applications: An Ex...
On the Distribution of Test Smells in Open Source Android Applications: An Ex...
 
A Preliminary Study of Android Refactorings
A Preliminary Study of Android RefactoringsA Preliminary Study of Android Refactorings
A Preliminary Study of Android Refactorings
 
Permission Issues in Open-Source Android Apps: An Exploratory Study
Permission Issues in Open-Source Android Apps: An Exploratory StudyPermission Issues in Open-Source Android Apps: An Exploratory Study
Permission Issues in Open-Source Android Apps: An Exploratory Study
 
A Career In IT
A Career In ITA Career In IT
A Career In IT
 
Web Content Management - Introduction
Web Content Management - IntroductionWeb Content Management - Introduction
Web Content Management - Introduction
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 

Recently uploaded

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 

Recently uploaded (20)

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 

An Exploratory Study on the Refactoring of Unit Test Files in Android Applications

  • 1. An Exploratory Study on the Refactoring of Unit Test Files in Android Applications Anthony Peruma, Christian D. Newman, Mohamed Wiem Mkaouer, Ali Ouni, Fabio Palomba 4 t h I n t e r n a t i o n a l W o r k s h o p o n R e f a c t o r i n g ( I W o R 2 0 2 0 )
  • 2. REFACTORING Smelly source code files Refactoring source code Smell free source code Smells are symptoms of bad programming practices – a threat to design Refactoring improves the internal design of software systems without altering its external behavior Refactoring involves locating and correcting smells exhibited by the source code An essential software maintenance activity Refactoring operations enable developers to take necessary actions to correct bad programming practices 01
  • 3. TEST SMELLS Test code, like production code, is subject to smells Formally introduced in 2001 with 11 smell types Inclusion of additional smell types, analysis of their evolution and longevity, and elimination patterns Tools to detect specific smell types Studies on traditional Java applications 02
  • 4. 2.5 million+ apps available on Google Play (December 2019) 03
  • 5. GOAL Expand our understanding of the relationship between refactoring changes and their effect on test smells in Android apps 04
  • 6. RESEARCH QUESTIONS What types of refactoring operations are applied to unit test files compared to non-test files?01 What types of refactoring operations are frequently applied to smelly test files?02 What kinds of refactorings are typically used to remove test smells?03 05
  • 7. CONTRIBUTIONS 01 An understanding of refactoring operations applied to test suites of Android apps 02 Insights into the relationships between refactoring operations and test smells 03 A dataset for replication and extension purposes, available on our project website 06
  • 8. EXPERIMENT DESIGN Dataset of test files & smells in Android apps Detection of refactoring operations Dataset of refactoring operations Analysis of results open-source apps: 250 refactored test files: 4,709 refactoring commits: 62,953 refactoring operations: 336,771 07
  • 9. TEST SMELLS & REFACTORING OPERATIONS ◸ Assertion Roulette ◸ Conditional Test Logic ◸ Constructor Initialization ◸ Default Test ◸ Duplicate Assert ◸ Eager Test ◸ Empty Test ◸ Exception Handling ◸ General Fixture ◸ Ignored Test . . . ◸ Rename Method ◸ Change Variable Type ◸ Rename Variable ◸ Inline Method ◸ Extract Method ◸ Move Class ◸ Move Method ◸ Pull Up Method ◸ Split Attribute ◸ Push Down Method. . . . 19 Test Smells 39 Refactoring Operations 08
  • 10. RQ 1 - What types of refactoring operations are applied to unit test files compared to non-test files? ◸ 91.98% of refactorings are applied to methods Vs. 8.02% to classes Refactoring Operations Count % Rename Method 1511 19.81% Change Variable Type 1452 19.03% Rename Variable 803 10.53% Change Attribute Type 773 10.13% Extract Method 426 5.58% Other Operations 2,664 34.29% Total 7,629 100% Refactoring Operations Count % Move Class 23,180 13.33% Change Parameter Type 14,178 8.15% Change Attribute Type 12,921 7.43% Rename Method 12,074 6.94% Rename Parameter 11,299 6.50% Other Operations 100,249 57.65% Total 173,901 100% Test Files Non-Test Files ◸ 49.27% of refactorings are applied to methods Vs. 50.73% to classes 65% 42% ◸ Test files tend to undergo more renames ◸ Non-test files are subject to more design level types of refactorings 09
  • 11. RQ 2 - What types of refactoring operations are frequently applied to smelly test files? Co-occurring Count %Smell Type Refactoring Operation Assertion Roulette Change Variable Type 141 53.01% Eager Test Extract Method 14 42.42% Lazy Test Extract Method 20 30.30% General Fixture Change Attribute Type 8 38.10% Redundant Assertion Move Method 9 29.03% Approach: Extracted test files that exhibited only one smell type and then looked at the refactorings in the file 4,589 test files that had one or more smells had undergone a refactoring The attribute is utilized in the setup() method The variable and the smell exist within a test method These smells and refactoring operation are related to test methods A debugging smell introduced when making design level changes 10
  • 12. RQ 3 - What kinds of refactorings are typically used to remove test smells? Approach: Lifetime history of a smelly test file; matched the refactoring applied with a smell reduction 38%2.121.30 Avg. smells removed by refactoring test file Avg. refactoring operations to reduce smell count Freq. for a single refactoring to remove a single smell type 481 Smelly test files that had a reduction & refactoring ◸ Change Variable Type being one of the most common refactorings applied when a smell is removed ◸ Eager Test is frequently resolved by developers when performing a single refactoring operation ◸ Please refer the paper for a qualitative based set of examples on the co-occurrence of smell type reduction and refactoring operations -- Extract Method resolving the Conditional Test Logic smell ◸ Manual review - most refactorings are applied for reasons other than for the correction of smell ◹ More in-depth, and developer supported, studies are needed 11
  • 13. TAKEAWAYS RQ 1 Developers are better prepared to estimate rework effort for (non-) test files Specialized tools for refactoring files RQ 2 Developers are better prepared in determining the most likely smell being introduced when performing a refactoring of a test file RQ 3 Refactoring of test files are mostly related to development activities such as fixing issues, adhering to coding standards, etc. 12
  • 14. SUMMARY Mined refactoring operations and test smells in 250 open-source Android apps01 App developers apply a different set of refactorings to test and non-test source code files02 There exist scenarios where refactoring operations are utilized to correct a test smell04 Certain test smells and refactoring operations that co- occur frequently (e.g., Lazy Test & Extract Method)03 13
  • 15. THANKS! h t t p s : / / t e s t s m e l l s . g i t h u b . i o