SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
On the Distribution of Test
Smells in Open Source
Android Applications: An
Exploratory Study
Anthony Peruma, Khalid Almalki, Christian D. Newman,
Mohamed Wiem Mkaouer, Ali Ouni, Fabio Palomba
29th Annual International Conference on Computer Science and Software Engineering
1.
Introduction
Software maintenance is not cheap!
3
I n t r o d u c t i o n
▸A high-quality system need not be necessarily
maintenance-friendly
▸Systems built using poor design/coding practices
can meet functional requirements
▸In the long run, such events impact software
maintenance - and maintenance is not cheap!
▹ Maintenance consumes 50% to 80% of resources
Towards maintenance-friendly code
4
I n t r o d u c t i o n
▸Researchers and industry have defined and created
approaches and tools to detect code in need of
refactoring
▹ Design/code smells - Cohesion, Coupling, God Class, etc.
▹ Tools - FindBugs, PMD, Checkstyle, etc.
▸Smells make code harder to understand and make it more
prone to bugs and changes
▸Research and tools have been primarily on production code
Test Smells
5
I n t r o d u c t i o n
▸Test code, like production code, is subject to smells
▸Formally introduced in 2001 with 11 smell types
▸Inclusion of additional smell types through the years, analysis
of their evolution and longevity, and elimination patterns
▸Tools to detect specific smell types
▸Studies on traditional Java applications
“2.6 million apps
available on Google Play
as of Q4 2018
Objective
Insight into the unit testing practices of
Android app developers with the aim of
providing developers a mechanism to
improve unit testing code
7
I n t r o d u c t i o n
Contribution
8
I n t r o d u c t i o n & O b j e c t i v e s
Open-Source Test Smell Detection Tool
Understanding of Test Smells in Android apps
Expansion of Test Smell Types
Replication Package Availability
Research Questions
9
I n t r o d u c t i o n
RQ 02
What is the general trend of test smells in Android apps over time?
▹ When are test smells first introduced into the project?
▹ How do test smells exhibited by the apps evolve over time?
RQ 01
How likely are Android apps to contain unit test smells?
▹ Are apps, that contain a test suite, prone to test smells?
▹ What is the frequency and distribution of test smells in apps?
▹ How does the distribution of smell types in Android apps compare against traditional
Java applications?
2.
Test Smells
Proposed Test Smells
11
T e s t S m e l l s
▸ Conditional Test Logic
▸ Constructor Initialization
▸ Default Test
▸ Duplicate Assert
▸ Empty Test
▸ Exception Handling
▸ Ignored Test
▸ Magic Number Test
▸ Redundant Print
▸ Redundant Assertion
▸ Sleepy Test
▸ Unknown Test
Practicability
12
T e s t S m e l l s
120smelly unit
test files
100software
systems
120software
developers
41.7%response
rate
Are our proposed smells indicative of problems?
Conditional Test Logic
13
T e s t S m e l l s
▸ Conditions within the test
method will alter the
behavior of the test and its
expected output
▸ Developers agree on the
negative impact on code
comprehension
▸ However, outright removal
may not always be
applicable – decide on a
“case by case basis”
I actually have no idea why that for loop is there.
It doesn’t do anything but run the test 1000
times, and there’s no point in that. I’ll remove it.
Constructor Initialization
14
T e s t S m e l l s
▸ Initialization of fields should
be in the setUp() method
(i.e., test fixtures)
▸ Most developers are aware
of test fixtures
▸ Developers unanimously
agree on using test fixtures
▸ Reasons for not using test
fixtures include “laziness”
and being “sloppy” I have already made this change since you
pointed it out so the code is clearer now
Default Test
15
T e s t S m e l l s
▸ Default test class meant to
serve as an example
▸ Should either be removed
▸ A test-first approach will
force developers to remove
the file
▸ Unanimous agreement
among developers that the
file “serves no concrete
purpose” and that it may
lead to confusion Removed useless example unit test
Duplicate Assert
16
T e s t S m e l l s
▸ The same condition is
tested multiple times within
the same test method
▸ The name of the test
method should be an
indication of the test
▸ Mixed responses - some
developers preferred to split
the assertion statement into
separate methods
I might enforce it on some bigger projects
Empty Test
17
T e s t S m e l l s
▸ When a test method has no
executable statements
▸ JUnit will indicate that the
test passes even if there are
no executable statements
present in the method body
▸ Unanimous agreement
among developers that such
test methods should be
removed from the test suite
Yes definitely should be removed
Exception Handling
18
T e s t S m e l l s
▸ Passing or failing of a test
method is explicitly
dependent on the production
method throwing an
exception
▸ Developers should utilize
JUnit’s exception handling
features to automatically
pass/fail
Ignored Test
19
T e s t S m e l l s
▸ Ignored test methods result
in overhead with regards to
compilation time and an
increase in code complexity
and comprehension
▸ Mixed responses -
investigate problems or
serve as a means for new
developers “to understand
behavior”
would not tolerate to have ignored tests in the code
Magic Number Test
20
T e s t S m e l l s
▸ Test method contains
unexplained and
undocumented numeric
literals
▸ Developers agree that the
use of constants over magic
numbers improve code
readability/understandability
▸ Not a blanket rule - a
constant should only be
used so that its “name adds
useful information”
If the numerical value has a deeper meaning (e.g.
flag, physical constant, enum value) then a
constant should be used.
Redundant Assertion
21
T e s t S m e l l s
▸ Assertion statements that
are either always true or
false
▸ Common reason for the
existence of this smell is
due to developer mistakes
▸ Developers confirmed that
such code “is not needed”,
“bad style” and “should
probably be removed”
▸ Might exist to support edge
cases
Redundant Print
22
T e s t S m e l l s
▸ Unit tests are executed as
part of an automated script
▸ They can consume
computing resources or
increase execution time
▸ Unanimous agreement that
print statements do not
belong in test suites
▸ A common reason for the
existence of this smell is
due to developer debugging
a waste of resources (cpu+disk space)
Sleepy Test
23
T e s t S m e l l s
▸ Explicitly causing a thread to
sleep can lead to
unexpected results as the
processing time for a task
differs when executed in
various environments and
configurations
▸ Developers confirmed that
there are risks (i.e.,
inconsistent results)
involved with causing a
thread to sleep
the alternative requires more code
Unknown Test
24
T e s t S m e l l s
▸ The assertion statement
helps to indicate the
purpose of the test
▸ JUnit will show the test
method as passing
▸ Majority of the developers
are in favor of having
assertion statements in a
test method
▸ Missing assertions were due
to mistakes
It looks like just sloppy coding there.
I'll look to fix that test
TSDetect
▸ Open-source, Java-based,
static analysis
▸ Available as a standalone
jar and requires a list of file
paths as input
▸ Utilizes an abstract syntax
tree to parse and detect
test smells
▸ Detects 19 test smells (12
proposed + 7 existing)
▸ Average F-Score of 96.5%
25
T e s t S m e l l s
High-level architecture of TSDetect
3.
Experiment Methodology
Data Collection Phase
27
E x p e r i m e n t M e t h o d o l o g y
F-Droid
Repositories
Data Mining
Tools
Mining
Output
2,011cloned apps
1,037,236
commits
6,379,006
java files affected by commits
+3.5 GB
java files collected
Detection Phase
28
E x p e r i m e n t M e t h o d o l o g y
Test File
Detection Tool
Test Smell
Detection Tool
Syntactically correct
test files with 1 or
more test methods
Detected test smells
656analyzed apps
206,598
detected test files
1,187,055
analyzed test methods
175,866
test files with 1 or more smells
4.
Analysis & Discussion
RQ1 – Test Smell Occurrence
Test Smell Occurrence & Distribution
▹ 97% of the analyzed apps contained test smells
▹ Assertion Roulette occurred the most (in over
50% of the analyzed apps and test files)
▹ All smell types had a high co-occurrence with
Assertion Roulette
▹ Similar distribution of test smells between
Android and non-Android applications
30
A n a l y s i s & D i s c u s s i o n
RQ1 – Test Smell Occurrence
31
0.00%
2.00%
4.00%
6.00%
8.00%
10.00%
12.00%
14.00%
16.00%
18.00%
S m e l l T y p e D i s t r i b u t i o n S m e l l T y p e O c c u r r e n c e
A n a l y s i s & D i s c u s s i o n
RQ1 – Test Smell Occurrence
32
A n a l y s i s & D i s c u s s i o n
S m e l l T y p e C o - O c c u r r e n c e
RQ2 – Test Smell Trend
33
A n a l y s i s & D i s c u s s i o n
Test Smell Introduction
▹ The first inclusion of a smelly file occurs
approximately 23% of the way through the total
app commits
▹ A test file is added with 3 smell types
▹ Assertion Roulette is the frequently the first
smell type introduced
▹ Smells exhibited by a file remains constant
throughout all updates to the file
5.
Conclusion
Summary
35
C o n c l u s i o n
▸ Extended the catalog of known
unit test smells
▸ Open source test smell
detection tool
▸ A study of 656 Android apps
showed a high prevalence of
test smells in test suites
▸ Smells are introduced early on
into the codebase and exist
during the lifetime of the app
▸ Comprehensive project website:
https://testsmells.github.io
Thanks!
https://testsmells.github.io

Weitere ähnliche Inhalte

Was ist angesagt?

Can we induce change with what we measure?
Can we induce change with what we measure?Can we induce change with what we measure?
Can we induce change with what we measure?Michaela Greiler
 
Strategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionStrategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionMichaela Greiler
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testingnazeer pasha
 
130817 latifa guerrouj - context-aware source code vocabulary normalization...
130817   latifa guerrouj - context-aware source code vocabulary normalization...130817   latifa guerrouj - context-aware source code vocabulary normalization...
130817 latifa guerrouj - context-aware source code vocabulary normalization...Ptidej Team
 
Exploring Exploratory Testing
Exploring Exploratory TestingExploring Exploratory Testing
Exploring Exploratory Testingnazeer pasha
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
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 APPLICATIONSijseajournal
 
Basics of software testing
Basics of software testingBasics of software testing
Basics of software testingPJS KUMAR
 
Search-based testing of procedural programs:iterative single-target or multi-...
Search-based testing of procedural programs:iterative single-target or multi-...Search-based testing of procedural programs:iterative single-target or multi-...
Search-based testing of procedural programs:iterative single-target or multi-...Vrije Universiteit Brussel
 
On the Malware Detection Problem: Challenges & Novel Approaches
On the Malware Detection Problem: Challenges & Novel ApproachesOn the Malware Detection Problem: Challenges & Novel Approaches
On the Malware Detection Problem: Challenges & Novel ApproachesMarcus Botacin
 
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
Finding Help with Programming Errors: An Exploratory Study of Novice Software...Finding Help with Programming Errors: An Exploratory Study of Novice Software...
Finding Help with Programming Errors: An Exploratory Study of Novice Software...Preetha Chatterjee
 
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...Preetha Chatterjee
 
Software testing
Software testingSoftware testing
Software testingprasad g
 
The End-to-End Use of Source Code Example: An Exploratory Study ICSM'09
The End-to-End Use of Source Code Example: An Exploratory Study  ICSM'09The End-to-End Use of Source Code Example: An Exploratory Study  ICSM'09
The End-to-End Use of Source Code Example: An Exploratory Study ICSM'09Rylan Cottrell
 
Sound Empirical Evidence in Software Testing
Sound Empirical Evidence in Software TestingSound Empirical Evidence in Software Testing
Sound Empirical Evidence in Software TestingJaguaraci Silva
 

Was ist angesagt? (20)

Can we induce change with what we measure?
Can we induce change with what we measure?Can we induce change with what we measure?
Can we induce change with what we measure?
 
Strategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software EvolutionStrategies to Avoid Test Fixture Smells durin Software Evolution
Strategies to Avoid Test Fixture Smells durin Software Evolution
 
Exploratory Testing
Exploratory TestingExploratory Testing
Exploratory Testing
 
130817 latifa guerrouj - context-aware source code vocabulary normalization...
130817   latifa guerrouj - context-aware source code vocabulary normalization...130817   latifa guerrouj - context-aware source code vocabulary normalization...
130817 latifa guerrouj - context-aware source code vocabulary normalization...
 
Exploring Exploratory Testing
Exploring Exploratory TestingExploring Exploratory Testing
Exploring Exploratory Testing
 
Unit testing
Unit testing Unit testing
Unit testing
 
[Tho Quan] Fault Localization - Where is the root cause of a bug?
[Tho Quan] Fault Localization - Where is the root cause of a bug?[Tho Quan] Fault Localization - Where is the root cause of a bug?
[Tho Quan] Fault Localization - Where is the root cause of a bug?
 
Software Testing 1/5
Software Testing 1/5Software Testing 1/5
Software Testing 1/5
 
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
 
Basics of software testing
Basics of software testingBasics of software testing
Basics of software testing
 
Search-based testing of procedural programs:iterative single-target or multi-...
Search-based testing of procedural programs:iterative single-target or multi-...Search-based testing of procedural programs:iterative single-target or multi-...
Search-based testing of procedural programs:iterative single-target or multi-...
 
10 software testing_technique
10 software testing_technique10 software testing_technique
10 software testing_technique
 
On the Malware Detection Problem: Challenges & Novel Approaches
On the Malware Detection Problem: Challenges & Novel ApproachesOn the Malware Detection Problem: Challenges & Novel Approaches
On the Malware Detection Problem: Challenges & Novel Approaches
 
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
Finding Help with Programming Errors: An Exploratory Study of Novice Software...Finding Help with Programming Errors: An Exploratory Study of Novice Software...
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
 
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
 
Test-Driven Development
Test-Driven DevelopmentTest-Driven Development
Test-Driven Development
 
Software testing
Software testingSoftware testing
Software testing
 
MSR2017-RevHelper
MSR2017-RevHelperMSR2017-RevHelper
MSR2017-RevHelper
 
The End-to-End Use of Source Code Example: An Exploratory Study ICSM'09
The End-to-End Use of Source Code Example: An Exploratory Study  ICSM'09The End-to-End Use of Source Code Example: An Exploratory Study  ICSM'09
The End-to-End Use of Source Code Example: An Exploratory Study ICSM'09
 
Sound Empirical Evidence in Software Testing
Sound Empirical Evidence in Software TestingSound Empirical Evidence in Software Testing
Sound Empirical Evidence in Software Testing
 

Ähnlich wie On the Distribution of Test Smells in Open Source Android Applications: An Exploratory Study

Automatic for the People
Automatic for the PeopleAutomatic for the People
Automatic for the PeopleAndy Zaidman
 
Chapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docxChapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docxketurahhazelhurst
 
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing pptKedar Kumar
 
Manual testing interview questions and answers
Manual testing interview questions and answersManual testing interview questions and answers
Manual testing interview questions and answersTestbytes
 
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptxabhivastrad007
 
Bug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsBug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsRIA RUI Society
 
Exploratory Testing, A Guide Towards Better Test Coverage.pdf
Exploratory Testing, A Guide Towards Better Test Coverage.pdfExploratory Testing, A Guide Towards Better Test Coverage.pdf
Exploratory Testing, A Guide Towards Better Test Coverage.pdfpCloudy
 
Chapter 8 - Software Testing.ppt
Chapter 8 - Software Testing.pptChapter 8 - Software Testing.ppt
Chapter 8 - Software Testing.pptGentaSahuri2
 
Orthogonal array approach a case study
Orthogonal array approach   a case studyOrthogonal array approach   a case study
Orthogonal array approach a case studyKarthikeyan Rajendran
 
Testing 2 - Thinking Like A Tester
Testing 2 - Thinking Like A TesterTesting 2 - Thinking Like A Tester
Testing 2 - Thinking Like A TesterArleneAndrews2
 
Quality Assurance & Quality Control for the field work
Quality Assurance & Quality Control for the field workQuality Assurance & Quality Control for the field work
Quality Assurance & Quality Control for the field workRicardo Valls P. Geo., M. Sc.
 
Quality assurance tests
Quality assurance testsQuality assurance tests
Quality assurance testsamitzore
 
Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...IJERA Editor
 

Ähnlich wie On the Distribution of Test Smells in Open Source Android Applications: An Exploratory Study (20)

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
 
Testing
TestingTesting
Testing
 
Automatic for the People
Automatic for the PeopleAutomatic for the People
Automatic for the People
 
Chapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docxChapter 10 Testing and Quality Assurance1Unders.docx
Chapter 10 Testing and Quality Assurance1Unders.docx
 
Software Testing 2/5
Software Testing 2/5Software Testing 2/5
Software Testing 2/5
 
Combinatorial testing ppt
Combinatorial testing pptCombinatorial testing ppt
Combinatorial testing ppt
 
Testing
TestingTesting
Testing
 
Manual testing interview questions and answers
Manual testing interview questions and answersManual testing interview questions and answers
Manual testing interview questions and answers
 
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
1779905011SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.pptx
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
 
Bug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsBug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutions
 
Black-Box
Black-BoxBlack-Box
Black-Box
 
Exploratory Testing, A Guide Towards Better Test Coverage.pdf
Exploratory Testing, A Guide Towards Better Test Coverage.pdfExploratory Testing, A Guide Towards Better Test Coverage.pdf
Exploratory Testing, A Guide Towards Better Test Coverage.pdf
 
Chapter 8 - Software Testing.ppt
Chapter 8 - Software Testing.pptChapter 8 - Software Testing.ppt
Chapter 8 - Software Testing.ppt
 
Testing &ampdebugging
Testing &ampdebuggingTesting &ampdebugging
Testing &ampdebugging
 
Orthogonal array approach a case study
Orthogonal array approach   a case studyOrthogonal array approach   a case study
Orthogonal array approach a case study
 
Testing 2 - Thinking Like A Tester
Testing 2 - Thinking Like A TesterTesting 2 - Thinking Like A Tester
Testing 2 - Thinking Like A Tester
 
Quality Assurance & Quality Control for the field work
Quality Assurance & Quality Control for the field workQuality Assurance & Quality Control for the field work
Quality Assurance & Quality Control for the field work
 
Quality assurance tests
Quality assurance testsQuality assurance tests
Quality assurance tests
 
Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...Comparison between Test-Driven Development and Conventional Development: A Ca...
Comparison between Test-Driven Development and Conventional Development: A Ca...
 

Mehr von 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
 
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
 
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 StudyUniversity 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
 
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 EvolutionUniversity 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 MessagesUniversity of Hawai‘i at Mānoa
 
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...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 StudyUniversity of Hawai‘i at Mānoa
 

Mehr von University of Hawai‘i at Mānoa (19)

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
 
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...
 
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
 
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
An Exploratory Study on the Refactoring of Unit Test Files in Android Applica...
 
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
 
SharePoint 2013 - Search Driven Publishing
SharePoint 2013 - Search Driven PublishingSharePoint 2013 - Search Driven Publishing
SharePoint 2013 - Search Driven Publishing
 

Kürzlich hochgeladen

Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
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
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
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
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Kürzlich hochgeladen (20)

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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
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 ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
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...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
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
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

On the Distribution of Test Smells in Open Source Android Applications: An Exploratory Study

  • 1. On the Distribution of Test Smells in Open Source Android Applications: An Exploratory Study Anthony Peruma, Khalid Almalki, Christian D. Newman, Mohamed Wiem Mkaouer, Ali Ouni, Fabio Palomba 29th Annual International Conference on Computer Science and Software Engineering
  • 3. Software maintenance is not cheap! 3 I n t r o d u c t i o n ▸A high-quality system need not be necessarily maintenance-friendly ▸Systems built using poor design/coding practices can meet functional requirements ▸In the long run, such events impact software maintenance - and maintenance is not cheap! ▹ Maintenance consumes 50% to 80% of resources
  • 4. Towards maintenance-friendly code 4 I n t r o d u c t i o n ▸Researchers and industry have defined and created approaches and tools to detect code in need of refactoring ▹ Design/code smells - Cohesion, Coupling, God Class, etc. ▹ Tools - FindBugs, PMD, Checkstyle, etc. ▸Smells make code harder to understand and make it more prone to bugs and changes ▸Research and tools have been primarily on production code
  • 5. Test Smells 5 I n t r o d u c t i o n ▸Test code, like production code, is subject to smells ▸Formally introduced in 2001 with 11 smell types ▸Inclusion of additional smell types through the years, analysis of their evolution and longevity, and elimination patterns ▸Tools to detect specific smell types ▸Studies on traditional Java applications
  • 6. “2.6 million apps available on Google Play as of Q4 2018
  • 7. Objective Insight into the unit testing practices of Android app developers with the aim of providing developers a mechanism to improve unit testing code 7 I n t r o d u c t i o n
  • 8. Contribution 8 I n t r o d u c t i o n & O b j e c t i v e s Open-Source Test Smell Detection Tool Understanding of Test Smells in Android apps Expansion of Test Smell Types Replication Package Availability
  • 9. Research Questions 9 I n t r o d u c t i o n RQ 02 What is the general trend of test smells in Android apps over time? ▹ When are test smells first introduced into the project? ▹ How do test smells exhibited by the apps evolve over time? RQ 01 How likely are Android apps to contain unit test smells? ▹ Are apps, that contain a test suite, prone to test smells? ▹ What is the frequency and distribution of test smells in apps? ▹ How does the distribution of smell types in Android apps compare against traditional Java applications?
  • 11. Proposed Test Smells 11 T e s t S m e l l s ▸ Conditional Test Logic ▸ Constructor Initialization ▸ Default Test ▸ Duplicate Assert ▸ Empty Test ▸ Exception Handling ▸ Ignored Test ▸ Magic Number Test ▸ Redundant Print ▸ Redundant Assertion ▸ Sleepy Test ▸ Unknown Test
  • 12. Practicability 12 T e s t S m e l l s 120smelly unit test files 100software systems 120software developers 41.7%response rate Are our proposed smells indicative of problems?
  • 13. Conditional Test Logic 13 T e s t S m e l l s ▸ Conditions within the test method will alter the behavior of the test and its expected output ▸ Developers agree on the negative impact on code comprehension ▸ However, outright removal may not always be applicable – decide on a “case by case basis” I actually have no idea why that for loop is there. It doesn’t do anything but run the test 1000 times, and there’s no point in that. I’ll remove it.
  • 14. Constructor Initialization 14 T e s t S m e l l s ▸ Initialization of fields should be in the setUp() method (i.e., test fixtures) ▸ Most developers are aware of test fixtures ▸ Developers unanimously agree on using test fixtures ▸ Reasons for not using test fixtures include “laziness” and being “sloppy” I have already made this change since you pointed it out so the code is clearer now
  • 15. Default Test 15 T e s t S m e l l s ▸ Default test class meant to serve as an example ▸ Should either be removed ▸ A test-first approach will force developers to remove the file ▸ Unanimous agreement among developers that the file “serves no concrete purpose” and that it may lead to confusion Removed useless example unit test
  • 16. Duplicate Assert 16 T e s t S m e l l s ▸ The same condition is tested multiple times within the same test method ▸ The name of the test method should be an indication of the test ▸ Mixed responses - some developers preferred to split the assertion statement into separate methods I might enforce it on some bigger projects
  • 17. Empty Test 17 T e s t S m e l l s ▸ When a test method has no executable statements ▸ JUnit will indicate that the test passes even if there are no executable statements present in the method body ▸ Unanimous agreement among developers that such test methods should be removed from the test suite Yes definitely should be removed
  • 18. Exception Handling 18 T e s t S m e l l s ▸ Passing or failing of a test method is explicitly dependent on the production method throwing an exception ▸ Developers should utilize JUnit’s exception handling features to automatically pass/fail
  • 19. Ignored Test 19 T e s t S m e l l s ▸ Ignored test methods result in overhead with regards to compilation time and an increase in code complexity and comprehension ▸ Mixed responses - investigate problems or serve as a means for new developers “to understand behavior” would not tolerate to have ignored tests in the code
  • 20. Magic Number Test 20 T e s t S m e l l s ▸ Test method contains unexplained and undocumented numeric literals ▸ Developers agree that the use of constants over magic numbers improve code readability/understandability ▸ Not a blanket rule - a constant should only be used so that its “name adds useful information” If the numerical value has a deeper meaning (e.g. flag, physical constant, enum value) then a constant should be used.
  • 21. Redundant Assertion 21 T e s t S m e l l s ▸ Assertion statements that are either always true or false ▸ Common reason for the existence of this smell is due to developer mistakes ▸ Developers confirmed that such code “is not needed”, “bad style” and “should probably be removed” ▸ Might exist to support edge cases
  • 22. Redundant Print 22 T e s t S m e l l s ▸ Unit tests are executed as part of an automated script ▸ They can consume computing resources or increase execution time ▸ Unanimous agreement that print statements do not belong in test suites ▸ A common reason for the existence of this smell is due to developer debugging a waste of resources (cpu+disk space)
  • 23. Sleepy Test 23 T e s t S m e l l s ▸ Explicitly causing a thread to sleep can lead to unexpected results as the processing time for a task differs when executed in various environments and configurations ▸ Developers confirmed that there are risks (i.e., inconsistent results) involved with causing a thread to sleep the alternative requires more code
  • 24. Unknown Test 24 T e s t S m e l l s ▸ The assertion statement helps to indicate the purpose of the test ▸ JUnit will show the test method as passing ▸ Majority of the developers are in favor of having assertion statements in a test method ▸ Missing assertions were due to mistakes It looks like just sloppy coding there. I'll look to fix that test
  • 25. TSDetect ▸ Open-source, Java-based, static analysis ▸ Available as a standalone jar and requires a list of file paths as input ▸ Utilizes an abstract syntax tree to parse and detect test smells ▸ Detects 19 test smells (12 proposed + 7 existing) ▸ Average F-Score of 96.5% 25 T e s t S m e l l s High-level architecture of TSDetect
  • 27. Data Collection Phase 27 E x p e r i m e n t M e t h o d o l o g y F-Droid Repositories Data Mining Tools Mining Output 2,011cloned apps 1,037,236 commits 6,379,006 java files affected by commits +3.5 GB java files collected
  • 28. Detection Phase 28 E x p e r i m e n t M e t h o d o l o g y Test File Detection Tool Test Smell Detection Tool Syntactically correct test files with 1 or more test methods Detected test smells 656analyzed apps 206,598 detected test files 1,187,055 analyzed test methods 175,866 test files with 1 or more smells
  • 30. RQ1 – Test Smell Occurrence Test Smell Occurrence & Distribution ▹ 97% of the analyzed apps contained test smells ▹ Assertion Roulette occurred the most (in over 50% of the analyzed apps and test files) ▹ All smell types had a high co-occurrence with Assertion Roulette ▹ Similar distribution of test smells between Android and non-Android applications 30 A n a l y s i s & D i s c u s s i o n
  • 31. RQ1 – Test Smell Occurrence 31 0.00% 2.00% 4.00% 6.00% 8.00% 10.00% 12.00% 14.00% 16.00% 18.00% S m e l l T y p e D i s t r i b u t i o n S m e l l T y p e O c c u r r e n c e A n a l y s i s & D i s c u s s i o n
  • 32. RQ1 – Test Smell Occurrence 32 A n a l y s i s & D i s c u s s i o n S m e l l T y p e C o - O c c u r r e n c e
  • 33. RQ2 – Test Smell Trend 33 A n a l y s i s & D i s c u s s i o n Test Smell Introduction ▹ The first inclusion of a smelly file occurs approximately 23% of the way through the total app commits ▹ A test file is added with 3 smell types ▹ Assertion Roulette is the frequently the first smell type introduced ▹ Smells exhibited by a file remains constant throughout all updates to the file
  • 35. Summary 35 C o n c l u s i o n ▸ Extended the catalog of known unit test smells ▸ Open source test smell detection tool ▸ A study of 656 Android apps showed a high prevalence of test smells in test suites ▸ Smells are introduced early on into the codebase and exist during the lifetime of the app ▸ Comprehensive project website: https://testsmells.github.io